How to check in git the commits in which a file was modified?

Question:

I have a Git repository for a corporate application that is just over 11 years old in development. The size of the repository is about 4.3GB. In the project there is a file named "X" in which I am working. How could I use Git to check the modifications that have been made to the file in all these years?

As additional information:

  1. The size of the repository is quite large.
  2. The file has been renamed one or more times during this entire time.
  3. The file I'm interested in was moved to the repository.
  4. The IDE that I use for the development and maintenance of the application is based on Eclipse (Spring Tool Suite) and this has a built-in Git option that allows me to see the commits that modified a file, but it only allows me to see from a moment that I know which is not the create one (a commit where the file was actually renamed, without telling me the old name).

If with Git it is not possible, but there is an application that allows me to do this, it would also be helpful.

Answer:

To get the change history of a specific file there is the --follow option of the git log

git log --follow -- nombreArchivo
  • The -- before nombreArchivo used to explicitly indicate that nombreArchivo corresponds to a file (and not, for example, to the name of a branch).

If you want to deliver this information in format patch (patch), then you run:

git log --follow -p -- nombreArchivo

You can check the documentation for the log command in English (I couldn't find it in Spanish):

Git – git-log Documentation

I looked in the Spanish translation of the GIT book , and didn't find the --follow option --follow .

Scroll to Top