When was the custom feature implemented in git?
You need to find out when the (version, commit, whatever) parameter --reset-author
was added to the command git commit
.
I already went to the GitHub repository looking for "reset -author". This only gave me the files actually containing the match, and I'm making git blame here and there isn't going anywhere.
Another approach would be to figure out the first occurrence of "reset -author" in the repo. I'm going to clone the entire repo locally right now and am trying to do this.
Is there an easier way?
source to share
Which retainer introduced the function?
The final posts in the Git project repository are pretty detailed. If you are cloning a Git repository,
cd ~/Desktop
git clone https://github.com/git/git
cd git
and run
git log --reverse --grep="reset-author"
first log entry:
commit c51f6ceed6a9a436f16f8b4f17eab1a3d17cffed
Author: Erick Mattos <erick.mattos@gmail.com>
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 <erick.mattos@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pay attention to the last paragraph:
New option
--reset-author
[...]
So there you go: This function was committed on Wednesday 4th November 2009 at 01:20:11 (timezone: -0200).
What version of Git did the feature come in?
Alternatively, you can pass the SHA of that commit to git-name-rev
to determine the earliest version where the commit occurred:
$ 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 that points to the start of the function; add the following entry in the section of [alias]
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 flag --reset-author
was introduced in Git v1.7.8.1.
source to share
1) cloned the repo locally
2) Looked for the reset -author line in the code (takes a while):
git log -S'reset-author'
go to the last match and here it is:
Author: Erick Mattos <erick.mattos@gmail.com>
Date: Wed Nov 4 01:20:11 2009 -0200
commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-author
...
Awesome commit messages btw which leads to a faster solution posted by @Jubobs. Search only in commit messages:
git log --grep="reset-author"
source to share