git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: git filter-branch re-write history over a range of commits did notwork

From
LU Chuck <chuck.lu@edenred.com>
Date
May 28, 2019, 07:10 UTC
Message-ID
<DB7PR05MB5573B5FC17FD1F221F7AAD558D1E0@DB7PR05MB5573.eurprd05.prod.outlook.com>
In-Reply-To
<fa23e865-94ed-308f-6a19-75b6ea89eec3@kdbg.org>
Show 42 quoted lines
> -----Original Message-----
> From: Johannes Sixt <j6t@kdbg.org>
> Sent: Tuesday, May 28, 2019 2:23 PM
> To: LU Chuck <Chuck.LU@edenred.com>
> Cc: Philip Oakley <philipoakley@iee.org>; git@vger.kernel.org; chuck.lu@qq.com
> Subject: Re: git filter-branch re-write history over a range of commits did notwork
> 
> 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://urldefense.proofpoint.com/v2/url?u=https-3A__git-2Dscm.com_docs_git
> -2Dfilter-2Dbranch-23-5Fexamples&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&
> r=VcGeIeOZ_8_zlrQNSboenYltfxGNIXN_qG6VpZgXVRk&m=VuNdOzceo68ZUnKOA
> cEPKJcWJGVbj9rVx7mqEMBkF9s&s=fwT_YsHVIcZLkZkXcwN0XzEfYZuZVvkThSM-
> V_o2na8&e=  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.
[LU Chuck] Sorry, I can't understand this part, did you have an documentation about the explanation for ...?
         "computes the mergebase between HEAD and HEAD" I have no idea about this. And you also talked about mergebase, but in my situation, there is only one branch with 5 commits. I did not have a mergebase.
         You can check the detail description below.
Show 21 quoted lines
> 
> >          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.
[LU Chuck] Hi Hannes,
         I have tried with the command you provided, what I got is 
             Rewrite 31cd5ef6f068c46222fe185870c09c959dd7113e (7/7) (6 seconds passed, remaining 0 predicted)
             WARNING: Ref 'refs/heads/master' is unchanged
         I am wondering why I got this warning, what I did have nothing to do with master branch.
         I am not on branch master. My current branch is temp and HEAD point to temp branch, and temp point to commit f70bf4.
         Actually you can clone the repository https://github.com/chucklu/LeetCode and git checkout -b temp origin/temp. Then do a simple test.
         My purpose is as I mentioned in last email,
         I have five commits A,B,C,D,E with commit id as following:
         A(67d9d9)<--B(9c1580)<--C(2eec4d)<--D(a45995)<--E(f70bf4)  
         The temp branch point to commit E(f70bf4) and the HEAD point to temp branch.
         The commits B,C,D,E 's commiter date and author date are not the same. I want to use filter-branch command to make the commiter date same as the author date.
> 
> -- Hannes
Previous: Johannes SixtNext: Philip Oakley
Message 6 of 11 in “git filter-branch re-write history over a range of commits did notwork”
  1. LU ChuckMay 27, 2019
  2. Johannes SixtMay 27, 2019
  3. Philip OakleyMay 27, 2019
  4. LU ChuckMay 28, 2019
  5. Johannes SixtMay 28, 2019
  6. LU ChuckMay 28, 2019
  7. Philip OakleyMay 28, 2019
  8. LU ChuckMay 28, 2019
  9. Johannes SchindelinMay 28, 2019
  10. LU ChuckMay 28, 2019
  11. LU ChuckMay 29, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.