Git,“你的分支领先于...”

时间:2014-03-28 14:20:33

标签: git

以下命令对我来说似乎是一个错误,但我不是一个git天才所以...

$ git status
# On branch master
nothing to commit, working directory clean

$ git pull origin master

 app/controllers/cool_controller.rb                   | 22 ++++++++++++++++++++--
 app/controllers/application_controller.rb            | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
 test/fixtures/interesting_model.yml                  |  2 +-
 test/fixtures/other_interesting_model.yml            | 10 +++++++++-

$ git status

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

我在这里不同意git,如果我刚从主人那里撤出而且之前没有任何变化,我怎么领先于主人呢?

如果我这样做,那么另一件事就是

git reset origin/master --hard

我失去了拉动的变化!因此,当我拉动时,git似乎没有更新本地origin/master。我该如何解决这个问题?

谢谢!

1 个答案:

答案 0 :(得分:1)

试试这个:

git fetch

有关此原因的更多信息,请参阅git: Your branch is Ahead by X commits