Is there a simple way to get a list of all the SHA's of all the commits made in the current branch back to the point where it was branched from master (I want all the commits and I don't want the output to require the user to hit a key to see those answers that don't fit on the screen)?
Asked
Active
Viewed 1,066 times
-2
-
Thanks; I did search for this but for some reason didn't come across that link in my searches. – Jon Cage Aug 10 '16 at 14:34
-
For the record, `git --no-pager log mybranch --pretty=format:"%H" --not master` got me what I actually wanted. – Jon Cage Aug 10 '16 at 14:37
-
Down-voting git inexperience seems a little harsh but I'll leave this question up as a duplicate in case anyone else is as weak as I am on Git terminology. – Jon Cage Aug 10 '16 at 14:37
3 Answers
4
Use git log mybranchn --pretty=format:"%H" --not master
to get the list of hashes of commits on your branch only without master's commits..

xenteros
- 15,586
- 12
- 56
- 91
2
You can use git log --format=format:%H master..
to get a list of just the SHAs.

alex
- 479,566
- 201
- 878
- 984
1
Use git log
with a proper format:
git log --format=format:%H master..your-branch
In most of the cases you can use HEAD
instead of specifying current branch name. Take a look on this page: https://git-scm.com/docs/git-checkout#_detached_head to find out when HEAD
does not point to the current branch.

Maciej Małecki
- 2,725
- 19
- 29
-
That seems close. Is there any way to list all of them without having to press a key to advance after the first screen full? – Jon Cage Aug 10 '16 at 14:29
-
@JonCage You could pipe it through `tee` and git won't turn on the pager. – alex Aug 10 '16 at 14:32
-
@alex: I found that adding `--no-pager` before the `log` parameter sorted it but thanks. – Jon Cage Aug 10 '16 at 14:38