差異處
這裏顯示兩個版本的差異處。
| 兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
| git [2017/11/03 22:54] – jz | git [2018/02/27 04:29] (目前版本) – jz | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | ====== | + | ====== |
| - | ===== bare ===== | + | ===== Bare ===== |
| - | convert | + | Convert |
| < | < | ||
| mkdir repo.git | mkdir repo.git | ||
| 行 10: | 行 10: | ||
| cd repo.git | cd repo.git | ||
| git config --bool core.bare true | git config --bool core.bare true | ||
| + | </ | ||
| + | |||
| + | ===== Archive ===== | ||
| + | https:// | ||
| + | < | ||
| + | # local | ||
| + | git archive --format zip --output /path master | ||
| + | # remote | ||
| + | # path is optional | ||
| + | git archive --format=tar \ | ||
| + | --remote=ssh:// | ||
| + | </ | ||
| + | ===== Shallow clone ===== | ||
| + | |||
| + | Convert shallow clone to full clone | ||
| + | < | ||
| + | git fetch --unshallow | ||
| + | git fetch --depth=2147483647 | ||
| + | </ | ||
| + | |||
| + | Convert full clone to shallow clone | ||
| + | |||
| + | https:// | ||
| + | < | ||
| + | git fetch --depth 10 / git fetch --deepen 10 | ||
| + | git reflog expire --expire=all --all | ||
| + | git tag -l | xargs git tag -d | ||
| + | git gc --prune=all | ||
| + | </ | ||
| + | |||
| + | https:// | ||
| + | < | ||
| + | ; Shallow to last 5 commits | ||
| + | git rev-parse HEAD~5 > .git/ | ||
| + | |||
| + | ; Manually remove all other branches, tags and remotes that refers to old commits | ||
| + | |||
| + | ; Prune unreachable objects | ||
| + | git fsck --unreachable ; Will show you the list of what will be deleted | ||
| + | git gc --prune=now | ||
| + | </ | ||
| + | |||
| + | ===== git shared repo ===== | ||
| + | < | ||
| + | [core] | ||
| + | sharedRepository = 0666 | ||
| </ | </ | ||
| 行 21: | 行 67: | ||
| </ | </ | ||
| - | [[http:// | + | ==== Stash ==== |
| + | < | ||
| + | git stash show -p stash@{1} | ||
| + | </ | ||
| + | |||
| + | ==== Rewrite ==== | ||
| + | < | ||
| + | svn-remote.< | ||
| + | This allows users to create repositories from alternate URLs. For example, an administrator could run git svn on the server locally (accessing via file://) but wish to distribute the repository with a public http:// or svn:// URL in the metadata so users of it will see the public URL. | ||
| + | |||
| + | svn-remote.< | ||
| + | Similar to the useSvmProps option; this is for users who need to remap the UUID manually. This may be useful in situations where the original UUID is not available via either useSvmProps or useSvnsyncProps. | ||
| + | </ | ||
| + | |||
| + | * [[http:// | ||
| + | * [[https:// | ||
| + | |||
| + | ===== Convert svn to git repo ===== | ||
| - | [[https://stackoverflow.com/questions/5975667/how-to-switch-svn-repositories-using-git-svn]] | + | [[https://epicserve-docs.readthedocs.io/en/latest/git/ |