2010-02-16 77 views
3

可能重複:
How do I push amended commit to the remote git repo?
Undoing a git push復卷遠程混帳分支

嗨,

我用

git reset --hard SHA_VALUE 
刪除從我的主分支作了一次提交

但是,我有一個遠程版本的github上的存儲庫,並且每當我遇到這種情況時,我都會收到一條錯誤消息,我應該合併遠程存儲庫中包含的更改(我不想)。

所以我的問題是,什麼是遠程相當於git reset命令?

thx

+2

在這裏看到:http://stackoverflow.com/questions/253055或在這裏:http://stackoverflow.com/questions/1270514 – 2010-02-16 09:23:55

+1

謝謝! git push origin + master:master爲我做了這個 – mvaz 2010-02-16 09:30:57

+0

在這種情況下,我投票結束時會重複「推送修改後的提交」,因爲它與您正在嘗試執行的操作具有相同的解決方案和陷阱。 – 2010-02-16 09:39:47

回答

0

我認爲你需要做一個「git rebase」。請查閱article關於重新印刷的信息,並閱讀標題爲「常見重新印刷使用實踐」的部分。

4

您可以使用 「混帳推」 與 「力」 選項

git push -f 
通過聯機手冊

-f, --force 
     Usually, the command refuses to update a remote ref that is not an ancestor of the local ref 
     used to overwrite it. This flag disables the check. This can cause the remote repository to 
     lose commits; use it with care.