GIT: Display modified files in the last 'n' commits.
It's a very common thing that a developer usually commits his / her work multiple times in a day. You make changes in your branch, commit them locally, and sometimes at the end of the day, you push them to the remote repository. If you want to see the changes in your last commit, you simply run the command:
git show
But what if you only want to see the names of the files which were changed? Okay, you run the same command with the --name-only parameter. i.e.
git show --name-only
Then what if you want to see all the files which were changed today? If you have made 3 commits today, then you can run the following command to view all the files which got affected across all your commits. To do this, you have to pass the -n parameter with the number of commits you want to view.
git show -n 3 --name-only
Okay, here's another useful tip. What if you want to see the files changed in a particular commit? For that, you only have to pass the commit id.
git show --name-only 4adf9baa857c885g5a40518ccec68961ae08cc69
And, what if you want to see the files changed in another commit along with these? To do that, again you have to pass the other commit id, as shown below.
git show --name-only 4adf9baa857c885g5a40518ccec68961ae08cc69 7bdf8bac852c865f4a40518cbec689613e07c269
That's it. I hope this will be helpful to someone :) Please don't forget to leave a comment if you know a better way or if this really helped you. You can also share this with your friends in Google+, Facebook and Twitter!
0 comments :
Post a Comment