使用GIT合并分支: git-merge and git-pull
合并分支[frankwang@apollo-2 test_git]$ git checkout masterSwitched to branch 'master'[frankwang@apollo-2 test_git]$ git merge "merge mybranch" HEAD mybranchUpdating a0586fe..3ae41f7Fast-forwar
合并分支
[frankwang@apollo-2 test_git]$ git checkout master
Switched to branch 'master'
[frankwang@apollo-2 test_git]$ git merge "merge mybranch" HEAD mybranch
Updating a0586fe..3ae41f7
Fast-forward
foo.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
上面的命令是将在分支“mybranch”的修改合并到分支“master”中,当前的工作分支是master
如果要将master的修改合并到mybranch中,需要先切换到mybranch,在使用git-merge命令
将现在的工作pull到主分支上去
[frankwang@apollo-2 test_git]$ git commit -m "add world in foo.c" foo.c
[mybranch 5d6d542] add world in foo.c
1 files changed, 2 insertions(+), 0 deletions(-)
[frankwang@apollo-2 test_git]$ git checkout master
Switched to branch 'master'
[frankwang@apollo-2 test_git]$ git pull . mybranch
From .
* branch mybranch -> FETCH_HEAD
Updating 3ae41f7..5d6d542
Fast-forward
foo.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)