Is there a way to do a git mv or have said happen upon refactor/rename?

Its not good practice to rename files in a git repository, better to use git mv. Trying to move my workflow completely away from the command line; which is not EZ. :-D


Taine

1
3 comments

Taine,

It's not true that it is "better to use git mv". It is just shorter when using command line.
'git mv a b' is a shortcut and total equivalent for 3 commands:
  mv  a b
  git add b
  git rm a
That's because Git doesn't store renames/moves - Git detects them.

So just move a file in IDEA, Git will prompt you for adding the file with new name. Deletion will be recorded in Changes View automatically.

1
Avatar
Permanently deleted user

Overstood, thx Kirill!

Taine

0

Word of caution here though. If you do rename in IDEA, probably best to commit that as an atomic commit and then start changing things in subsequent commits. Github at least seems to have a problem detecting the rename if you do both in the same commit.

1

Please sign in to leave a comment.