I wanted to view all the commits of a file from the beginning in reverse I ran
git log --reverse [file]
And it worked as expected. but for a renamed file it shows only from the commit in which it was renamed so I added --follow in it.
git log --reverse --follow [file]
but it now shows only the last commit which was done for that file.
How can I combine both to get the desired result.
With git log --follow , Git runs an after-diff step (called from diff_tree_sha1 ; see footnotes) that trims everything down to one file. The diff is done with R=C and L=P.
The easiest way to undo the last Git commit is to execute the “git reset” command with the “–soft” option that will preserve changes done to your files. You have to specify the commit to undo which is “HEAD~1” in this case. The last commit will be removed from your Git history.
Graph all git branches Developers can see all branches in the graph with the –all switch. Also, in most situations, the –decorate switch will provide all the supplemental information in a formatted and nicely color-coded way.
This seems to be known bug in git. The only work around I can see is if you know what the file was named before, pass it along with the current file to the command, i.e.
git log --reverse --follow -- oldfilename currentfilename
Edit: the following will do what you want:
git log --name-only --pretty="format:" --follow <filename> | sort -u | xargs git log --reverse --
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With