git 分支管理总结
git checkout -b 20140109_rpcspan_jiangyunpeng master
?本地分支push到remote
yunpeng@yunpeng-duitang:/duitang/dist/app/branches/eagleeye$ git push origin 20140109_rpcspan_jiangyunpengCounting objects: 146, done.Delta compression using up to 4 threads.Compressing objects: 100% (80/80), done.Writing objects: 100% (105/105), 13.09 KiB, done.Total 105 (delta 44), reused 1 (delta 0)
参考:
http://stackoverflow.com/questions/1911109/git-clone-a-specific-branch
http://stackoverflow.com/questions/2765421/how-to-push-a-new-local-branch-to-remote-repo-and-track-it-too
从remote获取到分支
git clone -b 20140109_rpcspan_jiangyunpeng git@xxx.xxx.com:middleware/xxx.git
?
把分支merge到master
#切换到masteryunpeng@yunpeng-duitang:~/test/temp/eagleeye$ git checkout masterBranch master set up to track remote branch master from origin.Switched to a new branch 'master'#查看分支情况yunpeng@yunpeng-duitang:~/test/temp/eagleeye$ git branch -r origin/20140109_rpcspan_jiangyunpeng origin/HEAD -> origin/master origin/master# 对开发分支进行合并,这条命令git会合并完成之后自动commitgit merge --no-ff 20140109_rpcspan_jiangyunpeng #如果不想自动ci ,参考:http://stackoverflow.com/questions/8640887/git-merge-without-auto-commityunpeng@yunpeng-duitang:~/test/temp/eagleeye$ git merge --no-commit --no-ff origin/20140109_rpcspan_jiangyunpeng
查看代码变更
#使用git diff没有效果,参考:http://stackoverflow.com/questions/4944376/how-to-check-real-git-diff-before-merging-from-remote-branchyunpeng@yunpeng-duitang:/duitang/dist/app/branches/eagleeye$ git diff origin/master
?
?
?如果提交了代码想revert掉,怎么办?
yunpeng@yunpeng-duitang:~/test/temp/eagleeye$ git st# On branch master# Your branch is ahead of 'origin/master' by 4 commits.yunpeng@yunpeng-duitang:~/test/temp/eagleeye$ git reset --hard origin/masterHEAD is now at d2c6808 Add: 增加对一个目录下有错误的 seq 文件的修复功能。增加 ListFiles 查看各个目录、文件的数据备份数和实际占用空间
?
?