git pull origin master仍然领先于origin / master 1提交

时间:2015-05-15 14:07:19

标签: git

我在master的本地副本上提交了一个提交,并最终将此提交添加到单独的分支/拉取请求中。现在我回到当地的主人那里,我从这里开始:

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

我想退出这个提交,因为它将从另一个分支合并,所以我:

git: (master) git pull origin master
From https://github.com/basho-labs/the-riak-community
 * branch            master     -> FETCH_HEAD
Already up-to-date.

我仍处于同一状态。为了摆脱这一点,我:

git:(master) git checkout HEAD~1
Note: checking out 'HEAD~1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at abd0327... 

但处理历史最干净的方法是什么?我不想要另一个commit,所以我不确定如何继续。我已经回顾了过去使用相似名称的对话,但没有看到有用的答案。

1 个答案:

答案 0 :(得分:0)

我不小心推了更多的提交,不得不考虑更多。我结束了:

git:(master)git reset --hard abd0327ec1b
HEAD is now at abd0327 Shortened introduction
git:(master)
git:(master) git status
On branch master
Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
  (use "git pull" to update your local branch)
nothing to commit, working directory clean
git:(master)
git:(master) git push -f
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/basho-labs/the-riak-community.git
 + 5e39499...abd0327 master -> master (forced update)

我对历史感到满意:

omglog output