差異處
這裏顯示兩個版本的差異處。
| Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
|
git [2017/12/15 10:54] jz |
git [2018/02/27 04:29] (目前版本) jz |
||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | ====== git ====== | + | ====== Git ====== |
| - | ===== bare ===== | + | ===== Bare ===== |
| - | convert existing git repo to bare repo | + | Convert existing git repo to bare repo |
| <code> | <code> | ||
| mkdir repo.git | mkdir repo.git | ||
| 行 12: | 行 12: | ||
| </code> | </code> | ||
| + | ===== Archive ===== | ||
| + | https://stackoverflow.com/questions/160608/do-a-git-export-like-svn-export | ||
| + | <code> | ||
| + | # local | ||
| + | git archive --format zip --output /path master | ||
| + | # remote | ||
| + | # path is optional | ||
| + | git archive --format=tar \ | ||
| + | --remote=ssh://remote_server/remote_repository master path1/ path2/ | tar -xv | ||
| + | </code> | ||
| ===== Shallow clone ===== | ===== Shallow clone ===== | ||
| 行 25: | 行 34: | ||
| https://stackoverflow.com/questions/38171899/how-to-reduce-the-depth-of-an-existing-git-clone | https://stackoverflow.com/questions/38171899/how-to-reduce-the-depth-of-an-existing-git-clone | ||
| <code> | <code> | ||
| - | git fetch --depth 10 | + | git fetch --depth 10 / git fetch --deepen 10 |
| git reflog expire --expire=all --all | git reflog expire --expire=all --all | ||
| git tag -l | xargs git tag -d | git tag -l | xargs git tag -d | ||
| git gc --prune=all | git gc --prune=all | ||
| + | </code> | ||
| + | |||
| + | https://stackoverflow.com/questions/4515580/how-do-i-remove-the-old-history-from-a-git-repository | ||
| + | <code> | ||
| + | ; Shallow to last 5 commits | ||
| + | git rev-parse HEAD~5 > .git/shallow | ||
| + | |||
| + | ; 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 ; Will actually delete your data | ||
| + | </code> | ||
| + | |||
| + | ===== git shared repo ===== | ||
| + | <code> | ||
| + | [core] | ||
| + | sharedRepository = 0666 | ||
| </code> | </code> | ||
| 行 38: | 行 65: | ||
| git svn dcommit | git svn dcommit | ||
| git svn rebase | git svn rebase | ||
| + | </code> | ||
| + | |||
| + | ==== Stash ==== | ||
| + | <code> | ||
| + | git stash show -p stash@{1} | ||
| </code> | </code> | ||
