2014-02-11 24 views
1

我做了git commit進入我的本地分支,然後做git pull。我是在遠程後面的一個提交,併合並了現在在git status中顯示的所有遠程更改,就像我修改它們一樣,事實並非如此。所以我想撤消git pull。我希望能夠使用git reset [email protected]{x}來做到這一點,其中X是來自reflog的ID,然後再進行拉取。但是這個pull並沒有顯示在reflog中,我需要撤消它在本地所做的所有混亂。我該怎麼做?git拉不顯示在reflog - 想重置它

回答

1

不要使用[email protected]{commit id},只需使用commit id

git reset commit_id 

而且,如果git pull移動分支的指針,你會看到,在引用日誌,但它會顯示爲merge origin/master,而不是「拉」。

+0

我以爲它沒有任何區別 – amphibient

+0

哪個,使用'git reset commit_id' vs'git reset head @ {commit_id}'?第二個版本無效,它不會指向提交,所以它不會執行任何操作。如果你想引用一個提交,使用它的ID。 – meagar