git-将dev代码合并到test

时间:2024-04-22 22:36:05

1. 在dev分支上刚开发完项目,执行以下命令:

  git add

  git commit -m 'dev'

  git push -u origin dev

2.切换到test分支上

  如果是多人开发,先把远程代码pull下来

  git pull origin test

  如果是单人开发,就没必要了,但为了保险起见,还是先pull一下

3.然后我们把dev上的代码合到test上

  git merge dev

4.然后查看状态

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

上面的意思就是你有12个commit,需要push到远程test上 (一定不要忘记了)
执行下面命令即可

git push origin test