zhanhailiang 日期:2015-01-06
View Current Branch List
[[Email protected]~/wade/git/billfeller.github.io]# git branch gh-pages * Master
New Branch
[[Email protected]~/wade/git/billfeller.github.io]# git branch dev
Switch branches
[[Email protected]~/wade/git/billfeller.github.io]# git checkout dev ' Dev'
Switch to New branch
[[Email protected]~/wade/git/billfeller.github.io]# git checkout-b dev2 'dev2'
Add information from the submitted file to the index library
test. Log
Adds all modified file information from the current file to the index library
.
File submissions will be made according to the contents of the index Library
'test' test 0 files changed, 0 insertions (+), 0 deletions (-) test . Log
See the difference between commits
[[Email protected]~/wade/git/billfeller.github.io]# git diff
Merge other branches into the current branch
[Email protected]~/wade/git/billfeller.github.io]# git merge dev2 Updating d509c69. Ce310ee Fast-forward 0 files changed, 0 insertions (+), 0 deletions (-) test. Log
Push the branch to the remote branch
[[email protected]~/wade/git/billfeller.github.io]# Git push Origin dev2 Co Unting objects:4, done . Compressing objects:100% (2/2), done . Writing objects:100% (3/3), 260 bytes, done . Total 3 (Delta 1), reused 0 (Delta 0) to [email protected]:billfeller/billfeller.github.io.git * [New branch] Dev2->
Dev2
viewing remote branches
[[Email protected]~/wade/git/billfeller.github.io]# git branch-r origin/head-> origin/master Origin/dev2 Origin/master
View local and remote branches
[[Email protected]~/wade/git/billfeller.github.io]# git branch-a dev * dev2 gh-pages Master remotes/origin/head-> origin/master remotes/origin/dev2 remotes/origin/master
Modify Branch Name
[Email protected]~/wade/git/billfeller.github.io]# git branch-m dev mdev [ email protected]~/wade/git/ billfeller.github.io]# git branch-a * dev2 gh-pages master mdev Remotes/origin/head- > origin/master remotes/origin/dev2 remotes/origin/master
Delete Remote Branch
[[email protected]~/wade/git/billfeller.github.io]# git push Origin-- Delete Dev2 to [email protected]:billfeller/billfeller.github.io.git-[deleted] Dev2 [[email protected]~/wade/git/billfeller.github.io]# git branch-a * Dev2 gh-pages Master Mdev remotes/origin/head-> Origin/master Remotes/origin/master
Reference article:
1. Git Getting Started Guide 11: Git branch Branch and merge branch
2. Git remote branch and refs file detailed
3. Git first experience (c) Git branch
GIT Branch Branch development