Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the first git commit that's not my commit going back in time?

Tags:

git

Is there a way in git to find the first (second, third) git commit that's not my own commit going back in time?

like image 270
Boon Avatar asked Jan 24 '26 17:01

Boon


1 Answers

The following commands may prove useful:

git shortlog

git log --committer '^(?!YOURAUTHORNAME).*$' --perl-regexp

or similarly,

git log --author '^(?!YOURAUTHORNAME).*$' --perl-regexp

These two variations of log use a regular expression to say "not my user."

You can find info on these commands here. Obviously replace YOURAUTHORNAME with enough characters of your own username to make it unique. If you absolutely only want the single most recent commit, include the --max-count=1 argument to the log command.

As demonstrated with other answers, there are many ways to produce this, including using other linux tools like grep or sed.

like image 117
Todd Avatar answered Jan 27 '26 09:01

Todd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!