Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij moves delete history in Git repo

In Intellij, I move files between packages and it seems that git removes and re-adds the file. How do I make Intellij git mv on class movements?

like image 204
David Williams Avatar asked Mar 30 '15 22:03

David Williams


People also ask

How can I see my Git history in IntelliJ?

Review file historySelect Git | Show History from the main VCS menu or from the context menu of the selection. The History tab is added to the Git tool window showing the history for the selected file and allowing you to review and compare its revisions.

How do I stop rebasing in IntelliJ?

Follow these steps: Open the repository folder in your terminal (linux, osx) or in the Git Bash (windows). Let's abort and start again, execute in the terminal: "git rebase --abort" .

How do I undo uncommitted changes in IntelliJ?

Revert uncommitted changes You can always undo the changes you've made locally before you commit them: In the Commit tool window Alt+0 , select one or more files that you want to revert, and select Rollback from the context menu, or press Ctrl+Alt+Z .

What is rebase in IntelliJ?

Interactive rebase will help you to take control of your project history meaning you can make it more meaningful where required or clean up commits by reording, skipping or squashing them. (documentation) Edit Project History with Interactive Rebase.


1 Answers

Git doesn't really have a concept of "moving a file"; the git mv command is just a shorthand for deleting and re-adding (plus actually moving the file in the file system). You can tell some of the git commands to try to detect renames/moves (by supplying a similarity threshold), but there's no way to record in the repository that file x has been moved to y.

However, a number of git commands are able to track changes across moved files, as long as the add+delete happens in the same commit. For example, git blame -C <filename> will show you the original author of each line, independently of who last moved the file.

like image 183
Aasmund Eldhuset Avatar answered Oct 29 '22 17:10

Aasmund Eldhuset