目前看,Git的主要优势是:
速度:速度非常快。
分布式:实际就是在原有的CS结构中,增加了一个中间层,在本地缓存remote的全部信息。
支持丰富:由于SVN相对老旧,Git的生态支持要好的多,通过Gitea、Gitlab等可以非常方便的建立一个功能丰富的Git Server,如果你再使用Docker技术,这个过程只需要几分钟。
常用命令
#远程源的操作
git clone
git remote
git fetch
git push
#本地缓存操作
git branch
#工作目录操作
git init
git checkout
git add
gitk --simplify-by-decoration --all
git log --graph --decorate --oneline --simplify-by-decoration --all
#迁移代码从svn
(https://www.lovelucy.info/codebase-from-svn-to-git-migration-keep-commit-history.html)
git svn clone --stdlayout --prefix "svn/" https://svn.app.local/svn/kometo/YSH-DB wmis
git svn fetch
git branch -r #导入的SVN中的分支信息保存在缓存区,但注册为远程分支(origin/branch**)
git checkout -b local_branch remote_branch #把需要的远程分支check到本地
git remote add origin ssh://git@git.udev.hk:udba/udba.git
git push -u origin master
git push origin --all
git push origin --tags
#重定向Master
#Make sure everything is pushed up to your remote repository (GitHub):
git checkout master
#Overwrite "master" with "better_branch":
git reset --hard better_branch
#Force the push to your remote repository:
git push -f origin master