之前是使用svn进行代码管理,现在换成git了,特此记录合并代码的命令与操作
在本地打开git bash here
例如将master的代码合并到develop-8.0.5-mentor分支 举例子
步骤1.切换到master
git checkout master
步骤2.拉取master的代码到本地(会显示有哪些代码拉取下来)
git pull
步骤3.再切换到develop-8.0.5-mentor分支
git checkout develop-8.0.5-mentor
执行后会提示Switched to branch 'develop-8.0.5-mentor'
Your branch is up to date with 'origin/develop-8.0.5-mentor'.
步骤4.执行合并命令
git merge master
步骤5.执行后会提示Merge branch 'master' into develop-8.0.5-mentor
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
意思是说需要输入解释,为什么合并?不需要的话就退出
如果要输入解释的话就需要执行下面的1、2步骤
1、按键盘上的“i”键可进入插入模式
2、这时可以修改最上方的黄色部分,改成你想写的合并原因
不输入解释的话,按照3、4步骤操作
3、按键盘上的“Esc”键退出插入模式
4、最后在最下面输入“ :wq ”后按回车键即可
然后会提示信息新增/更新了多少文件
最后执行git push,将代码推送到远程仓库
推理,分支代码合并带mater可以举一反三啦