顯示頁面 舊版 反向連結 本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。 ====== Git ====== ===== Bare ===== Convert existing git repo to bare repo <code> mkdir repo.git mv repo/.git repo.git rm -rf repo cd repo.git git config --bool core.bare true </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 ===== Convert shallow clone to full clone <code> git fetch --unshallow git fetch --depth=2147483647 </code> Convert full clone to shallow clone https://stackoverflow.com/questions/38171899/how-to-reduce-the-depth-of-an-existing-git-clone <code> 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 </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> ===== git-svn ===== <code> git svn clone -s http://svn-server/repo git svn fetch git svn dcommit git svn rebase </code> ==== Stash ==== <code> git stash show -p stash@{1} </code> ==== Rewrite ==== <code> svn-remote.<name>.rewriteRoot 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.<name>.rewriteUUID 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. </code> * [[http://www.radcortez.com/i-moved-to-git-svn/]] * [[https://stackoverflow.com/questions/5975667/how-to-switch-svn-repositories-using-git-svn]] ===== Convert svn to git repo ===== [[https://epicserve-docs.readthedocs.io/en/latest/git/svn_to_git.html]]