ericj
ericj

Reputation: 2301

Can I do a git mv with egit?

I can do on the command line:

$ git mv foo bar

and after this I commit.

Can I do git mv also in eclipse with egit?

Upvotes: 1

Views: 973

Answers (1)

howlger
howlger

Reputation: 34325

Yes, if in Window > Preferences: Team > Git > Committing the option Automatically stage files being moved is enabled, both the deleted old file and the new file are added to the index (alias staging area). This is the same behavior as with git mv.

Note, in Git there is no real/atomic mv: a commit of a moved file consists of a deletion of a file plus an addition of a file. Instead, Git tries to detect moving/renaming. Currently in Eclipse in the History view, moved files are shown correctly with their history, but e. g. cherry pick will fail because of the missing rename detection in JGit (see Eclipse bug 372606).

Upvotes: 1

Related Questions