Listing names of changed files between git commits - a step-by-step guide

When working with Git, it's important to know what files have been changed between commits. This can be easily accomplished by using the "git diff" command, which shows the differences between two commits.

Step 1: Identify the commits you want to compare. You can use "git log" to view a list of all the commits in your repository.

Step 2: Use the "git diff" command to compare the two commits. For example, if you want to compare the most recent commit with the one before it, use the command "git diff HEAD~1 HEAD".

Step 3: The output will show the changes made to each file between the two commits. To only see the list of file names that have been changed, use the "--name-only" flag. The command would then be "git diff --name-only HEAD~1 HEAD".

Step 4: If you only want to see the files that have been added or deleted, you can use the "--diff-filter" flag. For example, to only see the deleted files, use the command "git diff --name-only --diff-filter=D HEAD~1 HEAD".

By following these steps, you can easily list the names of changed files between Git commits, giving you a clear understanding of the changes made to your code base.

Click to rate this post!
[Total: 0 Average: 0]

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Go up

Below we inform you of the use we make of the data we collect while browsing our pages. You can change your preferences at any time by accessing the link to the Privacy Area that you will find at the bottom of our main page. More Information