Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default number of commits for Git log

Tags:

git

Is there any way to configure the default number of commits that will be returned by git log? I know you can do git log -5 to get the last 5 commits, but what if I forget and just do git log? I have several aliases for git log and would like them all to return something like the last 100 commits unless I specify something else specifically.

Ideal situation assuming I have git ls setup as an alias:

git ls returns the last 100

git ls -5 returns the last 5

It would be really great if I could to something like git ls -0 to disable the default and return everything.

Is any of this possible or should I consider this my first draft for a feature request to the Git team?

like image 521
AdmSteck Avatar asked Oct 15 '25 04:10

AdmSteck


1 Answers

If you supply more than one count, the last one takes precedence. For example, git log -2 -1 shows only one result.

So you can supply a default parameter in your alias definition and optionally override it when you run the command.

Regarding using -0 to return everything, just use -9999999 or similar instead.

like image 159
Matthew Strawbridge Avatar answered Oct 20 '25 21:10

Matthew Strawbridge