你的分支在3次提交之前超过'origin / master' [英] Your branch is ahead of 'origin/master' by 3 commits

查看:1705
本文介绍了你的分支在3次提交之前超过'origin / master'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行 git status

Your branch is ahead of 'origin/master' by 3 commits.

我已经阅读过其他一些文章,解决这个问题的方法是运行 git拉--rebase 但是什么是rebase,我会丢失数据还是这种与master同步的简单方法?

I have read on some other post the way to fix this is run git pull --rebase but what exactly is rebase, will I lose data or is this simple way to sync with master?

推荐答案

你得到这条消息是因为你在本地主服务器上做了修改,而你没有将它们推送到远端。你有几种方法来解决它,通常取决于你的工作流程如何:

You get that message because you made changes in your local master and you didn't push them to remote. You have several ways to "solve" it and it normally depends on how your workflow looks like:


  • 在一个好的工作流程中,主人应该是好的,而你的本地副本只是远程副本。使用此工作流程,您将永远不会再收到此消息。

  • 如果以另一种方式工作,并且应将本地更改推送到
    ,则只需 git push原产地假设原产地是您的远程

  • 如果您的本地更改不正确,请删除它们或将您的
    本地主设备重置为远程 git reset --hard origin / master

  • In a good workflow your remote copy of master should be the good one while your local copy of master is just a copy of the one in remote. Using this workflow you'll never get this message again.
  • If you work in another way and your local changes should be pushed then just git push origin assuming origin is your remote
  • If your local changes are bad then just remove them or reset your local master to the state on remote git reset --hard origin/master

这篇关于你的分支在3次提交之前超过'origin / master'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆