Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git revert creates conflict "deleted by us" due to rename

I'm trying to revert a commit made that modified a file that has since been renamed.

The file modified used to be called bin/internal/call_parser.rb, and is currently called lib/call_parser.rb, and I'm getting in my status after trying to do a revert

$ 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
#

As far as I can tell, the current version of lib/call_parser.rb and the then version of the file bin/internal/call_parser.br ought to be similar enough that git can detect the shared content (I've heard that git works on file content, not on file names). How can I tell git to work harder in order to detect the rename and therefore do the revert to content within lib/call_parser.rb ?

like image 966
Andrew Grimm Avatar asked Nov 03 '22 20:11

Andrew Grimm


1 Answers

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

Probably hacky, but Worked For Me (TM).

like image 172
Andrew Grimm Avatar answered Nov 07 '22 20:11

Andrew Grimm