Robert
Robert

Reputation: 313

Git log --pretty as git log --graph --oneline

I'm trying to replicate git log --graph --oneline with some information added. The problem is that my current alias shows me the logs for all branches like this:

$ git lg
* 7683440c6 - (origin/Branch1, Branch1) Message1 (48 minutes ago) by Author1
* 297b8a9cc - (HEAD -> Branch2, origin/Branch2) Message2 (4 days ago) by Author2
| * a21d8248e - (origin/Branch3, Branch3) Message3 (4 days ago) by Author2
| * 11f0f5aea - (origin/Branch4) Message4 (5 days ago) by Author3
| * b9b816d84 - (origin/Branch5) Message5 (5 days ago) by Author4
|/
| * 1acf9435f - (origin/Branch6, Branch6) Message6 (5 days ago) by Author1
|/
* 982aab25a - Message7 (5 days ago) by Author5
* 48df9d049 - Message8 (5 days ago) by Author5

and what I want is something like this:

$ git log --graph --oneline
* 297b8a9cc (HEAD -> Branch2, origin/Branch2) Message2
* 982aab25a Message7
* 48df9d049 Message8
* b409cbed5 Message9
* 2868a5794 Message10
* 46cd8e98f Message11
* 3c6ac0b8d Message12

As you can see I'm on Branch2 and git log --graph --oneline shows me only what is on this branch, but my alias shows my additional info (for rest of branches) and I don't want that. How can I replicate the above command on my alias so I have only the commits on my current branch (plus the ones on which Branch2 is on top - like git log --graph --oneline)?

My current alias looks like this:

lg = log --first-parent --graph --pretty=format:'%C(yellow)%h%Creset -%C(auto)%d%Creset %s %C(cyan)(%cr) %Cresetby %C(bold blue)%aN%Creset' --abbrev-commit --date=relative --branches

Upvotes: 1

Views: 4332

Answers (1)

LeGEC
LeGEC

Reputation: 52081

Remove the --branches from your alias.


--branches behaves as if you had explicitly written the names of all branches on the command line.

If you remove --branches from your git lg alias, you can still view all of your branches by typing

git lg --branches

Upvotes: 1

Related Questions