2012-07-18 82 views
5

我試圖恢復提交修改後的文件已被重命名。Git revert創建衝突「由我們刪除」,由於重命名

文件的修改曾經被稱爲bin/internal/call_parser.rb,目前所謂的lib/call_parser.rb,並試圖做一個還原

$ git status 
# On branch master 
# Your branch is ahead of 'origin/master' by 16 commits. 
# 
# Changes to be committed: 
# (use "git reset HEAD <file>..." to unstage) 
# 
# modified: other/unrelated/file 
# 
# Unmerged paths: 
# (use "git reset HEAD <file>..." to unstage) 
# (use "git add/rm <file>..." as appropriate to mark resolution) 
# 
# deleted by us:  bin/internal/call_parser.rb 
# 

至於我可以告訴以後我得到我的狀態,當前的版本lib/call_parser.rb和文件bin/internal/call_parser.br的當時版本應該足夠相似,git可以檢測到共享內容(我聽說git在文件內容上,而不是在文件名上)。如何讓git更加努力地檢測重命名,並因此恢復到lib/call_parser.rb中的內容?

回答

2
git mv lib/call_parser.rb bin/internal/call_parser.rb 
# Do the revert 
git mv bin/internal/call_parser.rb lib/call_parser.rb 

大概哈克,但爲我工作(TM)。