[英]How do I undo my committed and pushed changes to some of the tracking files in Git?
我是Git的新手。 我犯了一個錯誤,現在需要撤消相同的錯誤。 我是從遠程存儲庫克隆的,它在我的工作目錄中關閉了fileA和fileB。 我進行了提交,並且在該提交中,我從服務器上的內容修改了fileA和fileB。 (這些更改不應該投入生產)。
我還將提交推送到原始服務器的遠程分支。
現在,我需要做兩件事:
我該怎么做呢? 任何幫助將不勝感激。
如果您需要撤消上一次提交並保留更改,請reset
。
$ git checkout <your-branch>
$ git reset --soft HEAD~1 # undo last commits, and you've changes that you done.
now do change/fix
$ git commit -am 'new-message' # add & commit your changes
$ git push -f origin HEAD # force push to master
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.