当运行git状态时,我得到以下信息
Your branch is ahead of 'origin/master' by 3 commits.
我在其他一些帖子上读过,解决这个问题的方法是运行git拉—rebase,但rebase到底是什么,我会丢失数据吗,还是这是与主同步的简单方法?
当运行git状态时,我得到以下信息
Your branch is ahead of 'origin/master' by 3 commits.
我在其他一些帖子上读过,解决这个问题的方法是运行git拉—rebase,但rebase到底是什么,我会丢失数据吗,还是这是与主同步的简单方法?
当前回答
有一次我在Bitbucket上合并了一个pull请求,我就遇到了这种情况。
我只需要做:
git fetch
我的问题解决了。我希望这对你有帮助!!
其他回答
有一次我在Bitbucket上合并了一个pull请求,我就遇到了这种情况。
我只需要做:
git fetch
我的问题解决了。我希望这对你有帮助!!
使用这4个简单的命令
步骤1:git checkout <branch_name>
这是很明显的分支。
步骤2:git拉-s递归-X their
获取远程分支变更,并在发生冲突时替换它们的变更。 在这里,如果你使用git状态,你会得到这样的东西,你的分支领先'origin/master' 3次提交。
步骤3:git reset——hard origin/<branch_name> . zip
步骤4:git取回
硬重置你的分支。
享受。
这条来自git的消息意味着您已经在本地repo中进行了三次提交,并且还没有将它们发布到主存储库。要运行的命令是git push{本地分支名称}{远程分支名称}。
The command git pull (and git pull --rebase) are for the other situation when there are commit on the remote repo that you don't have in your local repo. The --rebase option means that git will move your local commit aside, synchronise with the remote repo, and then try to apply your three commit from the new state. It may fail if there is conflict, but then you'll be prompted to resolve them. You can also abort the rebase if you don't know how to resolve the conflicts by using git rebase --abort and you'll get back to the state before running git pull --rebase.
Git重置-硬源/主
使用这个命令
通常,如果我必须检查哪些提交与主提交不同,我会这样做:
git rebase -i origin/master
通过这种方式,我可以看到提交,并决定放弃它或选择…