简体   繁体   English

git:合并两个分支并提交

[英]git: merging two branches and commits ahead

I have two branches:master and v2. 我有两个分支:master和v2。 I want to merge v2 in master so master will be exactly the same as v2. 我想在master中合并v2,因此master将与v2完全相同。 I did this: 我这样做了:

$> git checkout master
$> git merge -Xtheirs v2

now "git status" returns: 现在“git status”返回:

Your branch is ahead of 'origin/master' by 201 commits. 您的分支在201次提交之前领先于“origin / master”。

How can I "align" my remote repos with the stuff I have locally? 如何将我的远程回购与我本地的东西“对齐”?

You need to push it to remote repo. 你需要把它推到远程仓库。

git push origin master will do it. git push origin master会做到这一点。

You have it backwards you should be merging v2 into master. 你有它倒退你应该将v2合并到主人。 This will bring master up to date, and will allow you to keep working in v2 afterwards. 这将使主人更新,并允许你继续在v2工作。

Once you have your master up to date, you push it to the remote server with. 一旦掌握了最新版本,就可以将其推送到远程服务器。

git push

That will push your synced branches from your local machine to your remote branch 这会将您同步的分支从本地计算机推送到远程分支

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM