Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View order of a list of git commits

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!

like image 403
dmaz99 Avatar asked Nov 10 '16 16:11

dmaz99


People also ask

How do you order commits?

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.

How do I see a list of my commits?

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.

How do I sort git logs?

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.

How would you display the list of files changed in a particular commit?

Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command.


1 Answers

Use the --no-walk option. It works on everything based off git rev-list.

like image 157
jthill Avatar answered Sep 21 '22 16:09

jthill