Sergei Basharov
Sergei Basharov

Reputation: 53850

How to get the oldest change applied by <username> in a git repo?

When working in WebStorm, I can see who changed the code in the open file by opening revisions panel. As I understand, this information is kept inside git and can be fetched.

So, I wonder, if it's possible to find the oldest change made by some username? Are there tool to perform operations like history searching/filtering by username?

Upvotes: 1

Views: 198

Answers (2)

ElpieKay
ElpieKay

Reputation: 30868

git log --pretty='%ad %h' --author='<name>' --date=format:'%Y-%m-%d %H:%M:%S' <branch> | sort | head -1

If you want the commit date, use %cd instead of %ad. --date=iso might be okay.

Upvotes: 0

Vasyl Korytov
Vasyl Korytov

Reputation: 66

git log --author=user --reverse will give you the list of commits by this user sorted from earliest to newest. See git-log(1) for more details.

Upvotes: 3

Related Questions