您需要記住的是,git pull
實際上是一個兩步過程。首先它使用fetch
來檢索遠程文件。然後,它會嘗試執行fast-forward
merge
以將更改直接應用於工作之上。
所以在遙控器上使用fetch
。這將確保您在git倉庫中設置了遠程更改。我想說的運行從混帳回購協議如下:
ls | xargs -I'{}' git checkout -- '{}'
但你說你在Windows中,所以你可能只是通過具有循環和做手工。此外,這假定沒有新的文件在您的回購的根目錄中創建。
現在,如果您確實想恢復目錄的創建,請執行以下操作(假定遠程爲origin
,分支爲master
)。
git update-ref refs/heads/master $(git rev-parse origin/master)
git add --all .
# amend the commit to remove the folder from history
# only do this if you can rebase the remote w/o repercussion
git commit --amend
# otherwise just add a new commit on top of the old
git commit
現在看日誌,看看是否一切正常,如果是的話那麼推到遠程(如果你使用--amend
,那麼你就必須強制推送)。
「在Mac上工作時」 - 爲什麼不從Mac中刪除它? – valentinas 2013-03-19 02:25:11
Mac正在工作,我需要將這些更改拖到我家的計算機上。 – 2013-03-19 02:26:34