From: Johannes Sixt <j6t@kdbg.org>
To: LU Chuck <Chuck.LU@edenred.com>
Cc: Philip Oakley <philipoakley@iee.org>,
"git@vger.kernel.org" <git@vger.kernel.org>,
"chuck.lu@qq.com" <chuck.lu@qq.com>
Subject: Re: git filter-branch re-write history over a range of commits did notwork
Date: Tue, 28 May 2019 08:23:08 +0200 [thread overview]
Message-ID: <fa23e865-94ed-308f-6a19-75b6ea89eec3@kdbg.org> (raw)
In-Reply-To: <DB7PR05MB5573B5B80C8A9CBE867803D88D1E0@DB7PR05MB5573.eurprd05.prod.outlook.com>
Am 28.05.19 um 07:42 schrieb LU Chuck:
>> From: Philip Oakley <philipoakley@iee.org>
>> The three dots is provided in the literal EXAMPLES section of the man page. That is
>> probably an error, as I think it is meant to be an ellipsis to indicate 'insert other
>> options here'.
>>
>> Simply remove the three dots ('symmetric diff notation') .
>>
>> Not sure what the correct change to the man page should be, but clearly it has
>> caused confusion. It also takes a moment to properly realise which commits the
>> two dot notation will refer to in the example which may further compound the
>> confusion about the three dots.
>>
>> Philip
> [LU Chuck] Hi Hannes,
> I used ... literally when I cited the command. I write the command with ... directly as the document introduce the usage like that.
> You can check the document https://git-scm.com/docs/git-filter-branch#_examples about the --env-filter section.
Copying and pasting examples literally is dangerous. You should know
what you are doing.
"..." is a revision range that computes the mergebase between HEAD and
HEAD, which is (surprise!) HEAD, and then includes the two end points,
but excludes everything below the mergebase. So, the revision
specification that your command ends up with is
HEAD HEAD ^HEAD ^67d9d9 f70bf4
Which is empty if f70bf4 is an ancestor of HEAD.
> Hi Philip,
> I also tried to execute the command without ...,
> git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' 67d9d9..f70bf4
> then I will get another error " You must specify a ref to rewrite."
You cannot restrict your filter to a subset of commits like this. After
all, all commits that descend from one of the rewritten commits must
also change, up to and including to the branch refs. Therefore, it is
necessary to mention the branches that you rewrite in this manner.
Perhaps:
git filter-branch --env-filter '
if git merge-base --is-ancestor $GIT_COMMIT f70bf4; then
export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
fi' -- 67d9d9..master
This assumes that only branch master is affected by the rewriting. Use
--all if you have many affected branches.
-- Hannes
next prev parent reply other threads:[~2019-05-28 6:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-27 8:01 git filter-branch re-write history over a range of commits did notwork LU Chuck
2019-05-27 18:21 ` Johannes Sixt
2019-05-27 20:22 ` Philip Oakley
2019-05-28 5:42 ` LU Chuck
2019-05-28 6:23 ` Johannes Sixt [this message]
2019-05-28 7:10 ` LU Chuck
2019-05-28 9:33 ` Philip Oakley
2019-05-28 9:53 ` LU Chuck
2019-05-28 9:57 ` Johannes Schindelin
2019-05-28 9:59 ` LU Chuck
2019-05-29 5:15 ` LU Chuck
-- strict thread matches above, loose matches on Subject: below --
2019-05-27 8:11 LU Chuck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fa23e865-94ed-308f-6a19-75b6ea89eec3@kdbg.org \
--to=j6t@kdbg.org \
--cc=Chuck.LU@edenred.com \
--cc=chuck.lu@qq.com \
--cc=git@vger.kernel.org \
--cc=philipoakley@iee.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).