git命令合master和其他分支代码

来源:互联网 发布:mac装win7加载驱动程序 编辑:程序博客网 时间:2024/05/22 00:30
模拟场景:现在有两个分支master(主分支)和other,你在other分支上开发代码了,现在想将other分支合并到master。项目有可能有很多的分支,例如项目分支master、other、other1、other2等分支都需要将代码合并到master上的,进行发布上线。

1 分别切换到other、master拉取最新代码

git  pull

2 将master代码合并到other分支,首先切换到other分支

git checkout other

然后将master代码合并到other

 git merge master

最后注意如果有冲突需要解决冲突,没有冲突也需要push代码

git push

3 切换到master分支,将other代码合并到master上,如果2步骤。

原创粉丝点击