I have a list of commit hashes and I need to order them chronologically.
I thought I could get git rev-list
to do it, but it insists on showing me all the commits even if I specify a commit on the command line.
Is there a way to make git do this or do I have to combine git rev-list
and grep
?
Thanks!
SourceTree makes reordering commits really easy. Right click on the last commit of the remote branch (origin/master for example), and choose “rebase children of <hash> interactively…” from the context menu. A dialog will appear with a list of the commits that are above the one you selected.
On GitHub.com, you can access your project history by selecting the commit button from the code tab on your project. Locally, you can use git log . The git log command enables you to display a list of all of the commits on your current branch. By default, the git log command presents a lot of information all at once.
So one way to do that would be to use git log pretty=format: ... to print the commit date in ISO format and let sort or sort -r fix the order. This will print the ISO date, the hash, the author and the message of the commit and sort it with the latest commits first.
Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command.
Use the --no-walk
option. It works on everything based off git rev-list
.
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