Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When was a specific feature implemented in git?

Need to find out when (version, commit, whatever) the --reset-author option was added to the git commit command.

I already went to the GitHub repo, search for "reset-author". That gave me only the files actually containing the match, and I doing git blame here and there doesn't take me anywhere.

Another approach would be to find out the first occurence of "reset-author" on the repo. I'm going to clone the whole repo locally right now and try to do that.

Is there a simpler way?

like image 809
Maximiliano Padulo Avatar asked Dec 29 '25 17:12

Maximiliano Padulo


1 Answers

Which commit introduced the feature?

Commit messages in the Git project repo are quite detailed. If you clone the Git repo,

cd ~/Desktop
git clone https://github.com/git/git
cd git

and run

git log --reverse --grep="reset-author"

the first log entry is:

commit c51f6ceed6a9a436f16f8b4f17eab1a3d17cffed
Author: Erick Mattos <[email protected]>
Date:   Wed Nov 4 01:20:11 2009 -0200

    commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-a

    When we use -c, -C, or --amend, we are trying one of two things: using the
    source as a template or modifying a commit with corrections.

    When these options are used, the authorship and timestamp recorded in the
    newly created commit are always taken from the original commit.  This is
    inconvenient when we just want to borrow the commit log message or when
    our change to the code is so significant that we should take over the
    authorship (with the blame for bugs we introduce, of course).

    The new --reset-author option is meant to solve this need by regenerating
    the timestamp and setting the committer as the new author.

    Signed-off-by: Erick Mattos <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>

Note the last paragraph:

The new --reset-author option [...]

So there you go: that feature was committed on Wednesday, November 4th, 2009, at 01:20:11 (time zone: -0200).

In which version of Git did the feature first appear?

Moreover, you can pass the SHA of that commit to git-name-rev in order to determine the earliest version in which the commit appeared:

$ git name-rev --name-only c51f6ceed6a9a436f16f8b4f17eab1a3d17cffed
tags/v1.7.8.1~8^2~1

In this case: Git v1.7.8.1.

Here is an alias for that pinpointing the inception of the feature; add the following entry under the [alias] section of one of your Git config files:

inception = "!f() { git name-rev --name-only $(git log --pretty=format:\"%H\" --grep=\"$1\" --reverse master | head -1); }; f"

Then you can do

$ git inception "--reset-author"
tags/v1.7.8.1~8^2~1

which indicates that the --reset-author flag was introduced in Git v1.7.8.1.

like image 194
jub0bs Avatar answered Jan 01 '26 11:01

jub0bs



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!