2016年4月21日 星期四

Github 中回溯過去某一個commit




有時候可能(只是可能..)
已經存在github上的repo最新的檔案是錯的或是想要更改的話..
(當然還有其他是用的情況..

例如今天想要回溯到

initial empty rails project















首先

在本機端( local )檢查目前在github上repo的最新進度是否符合

git log



第二步


先在本機端下

git reset --hard  <initial empty rails project 的commint hash >














這時候透過 git log 應該可以發覺commit已經回溯到之前的commit了









這時候就要github 上的進度也把它回溯

git push -f <remote-name> <branch-name>

以這裡的情況

git push -f origin master






這個時候再到github 上看一下就之到了










ok 妥當...

但看資料來源說在團隊(協同)開發的環境下最好不要這樣做~


資料來源:http://stackoverflow.com/questions/4372435/how-can-i-rollback-a-github-repository-to-a-specific-commit

沒有留言:

張貼留言