git两个分支最新的代码合并


1.切换到dev分支

$ git checkout dev
Switched to branch 'dev'
Your branch is behind 'origin/dev' by 196 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

2.查看dev分支状态

$ git status
On branch dev
Your branch is behind 'origin/dev' by 196 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
nothing to commit, working tree clean

3.拉取dev最新代码

$ git pull
Checking out files: 100% (292/292), done.


............

4.再次检查dev状态

$ git status
On branch dev
Your branch is up-to-date with 'origin/dev'.
nothing to commit, working tree clean


5.没有新代码更新

$ git fetch

6.合并pages的远程分支,肯定是最新代码

$ git merge origin/pages

7、处理解决冲突

$ git status
On branch dev
Your branch is up-to-date with 'origin/dev'.
All conflicts fixed but you are still merging.
  (use "git commit" to conclude merge)


8、解决冲突后提交

$ git commit -m '合并pages分支,tomcat启动没有问题'
[dev 921a4db04] 合并pages分支,tomcat启动没有问题

9、推送到服务器

$ git push
Counting objects: 64, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (61/61), done.
Writing objects: 100% (64/64), 7.27 KiB | 0 bytes/s, done.


$ git status
On branch dev
Your branch is up-to-date with 'origin/dev'.
nothing to commit, working tree clean


10、将pages与dev同步

$ git checkout pages
Switched to a new branch 'pages'
Branch pages set up to track remote branch pages from origin

$ git status
On branch pages
Your branch is up-to-date with 'origin/pages'.
nothing to commit, working tree clean


$ git merge origin/dev
Checking out files: 100% (256/256), done.
Updating 4531a50d1..921a4db04
Fast-forward


$ git status
On branch pages
Your branch is ahead of 'origin/pages' by 201 commits.
  (use "git push" to publish your local commits)
nothing to commit, working tree clean


$ git push
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: To create a merge request for pages, visit:

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值