git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
* git filter-branch re-write history over a range of commits did notwork
@ 2019-05-27  8:01 LU Chuck
  2019-05-27 18:21 ` Johannes Sixt
  0 siblings, 1 reply; 12+ messages in thread
From: LU Chuck @ 2019-05-27  8:01 UTC (permalink / raw)
  To: git; +Cc: chuck.lu

Hi team,

    The issue comes from https://github.com/git-for-windows/git/issues/2206.

    I want to re-write history by filter-branch command over a range of commits, but the command did not work.
    I have referred to the following three documentation about how to use git filter-branch:
    https://stackoverflow.com/questions/15250070/running-filter-branch-over-a-range-of-commits
    https://stackoverflow.com/questions/28536980/git-change-commit-date-to-author-date
    https://git-scm.com/docs/git-filter-branch

    You can reproduce the problem by the following steps
    1. clone the repository https://github.com/chucklu/LeetCode/
    2. checkout to the temp branch
    3. run the command git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' ... 67d9d9..f70bf4
    4. You will got the info "Found nothing to rewrite"
 
    However, it was supposed to overwrite the history from commit 9c1580 to commit f70bf4, make the commit date same as date.
    I am not sure if I am using the filter-branch correctly, or if there is a bug in git?

    Anyone can help me? Thanks in advance.

Chuck Lu
Regards

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: git filter-branch re-write history over a range of commits did notwork
  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
                     ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Johannes Sixt @ 2019-05-27 18:21 UTC (permalink / raw)
  To: LU Chuck; +Cc: git, chuck.lu

Am 27.05.19 um 10:01 schrieb LU Chuck:
> Hi team,
> 
>     The issue comes from https://github.com/git-for-windows/git/issues/2206.
> 
>     I want to re-write history by filter-branch command over a range of commits, but the command did not work.
>     I have referred to the following three documentation about how to use git filter-branch:
>     https://stackoverflow.com/questions/15250070/running-filter-branch-over-a-range-of-commits
>     https://stackoverflow.com/questions/28536980/git-change-commit-date-to-author-date
>     https://git-scm.com/docs/git-filter-branch
> 
>     You can reproduce the problem by the following steps
>     1. clone the repository https://github.com/chucklu/LeetCode/
>     2. checkout to the temp branch
>     3. run the command git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' ... 67d9d9..f70bf4

Did you not tell us everything because you write ... in this message
when you cited the command you used, or do you say that you used ...
literally in the command?

>     4. You will got the info "Found nothing to rewrite"
>  
>     However, it was supposed to overwrite the history from commit 9c1580 to commit f70bf4, make the commit date same as date.
>     I am not sure if I am using the filter-branch correctly, or if there is a bug in git?
> 
>     Anyone can help me? Thanks in advance.

-- Hannes

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: git filter-branch re-write history over a range of commits did notwork
  2019-05-27 18:21 ` Johannes Sixt
@ 2019-05-27 20:22   ` Philip Oakley
  2019-05-28  5:42     ` LU Chuck
  2019-05-28  9:59   ` LU Chuck
  2019-05-29  5:15   ` LU Chuck
  2 siblings, 1 reply; 12+ messages in thread
From: Philip Oakley @ 2019-05-27 20:22 UTC (permalink / raw)
  To: Johannes Sixt, LU Chuck; +Cc: git, chuck.lu

Hi Chuck,

On 27/05/2019 19:21, Johannes Sixt wrote:
> Am 27.05.19 um 10:01 schrieb LU Chuck:
>> Hi team,
>>
>>      The issue comes from https://github.com/git-for-windows/git/issues/2206.
>>
>>      I want to re-write history by filter-branch command over a range of commits, but the command did not work.
>>      I have referred to the following three documentation about how to use git filter-branch:
>>      https://stackoverflow.com/questions/15250070/running-filter-branch-over-a-range-of-commits
>>      https://stackoverflow.com/questions/28536980/git-change-commit-date-to-author-date
>>      https://git-scm.com/docs/git-filter-branch
>>
>>      You can reproduce the problem by the following steps
>>      1. clone the repository https://github.com/chucklu/LeetCode/
>>      2. checkout to the temp branch
>>      3. run the command git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' ... 67d9d9..f70bf4
> Did you not tell us everything because you write ... in this message
> when you cited the command you used, or do you say that you used ...
> literally in the command?

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
>
>>      4. You will got the info "Found nothing to rewrite"
>>   
>>      However, it was supposed to overwrite the history from commit 9c1580 to commit f70bf4, make the commit date same as date.
>>      I am not sure if I am using the filter-branch correctly, or if there is a bug in git?
>>
>>      Anyone can help me? Thanks in advance.
> -- Hannes


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: git filter-branch re-write history over a range of commits did notwork
  2019-05-27 20:22   ` Philip Oakley
@ 2019-05-28  5:42     ` LU Chuck
  2019-05-28  6:23       ` Johannes Sixt
  0 siblings, 1 reply; 12+ messages in thread
From: LU Chuck @ 2019-05-28  5:42 UTC (permalink / raw)
  To: Philip Oakley, Johannes Sixt; +Cc: git, chuck.lu



> -----Original Message-----
> From: Philip Oakley <philipoakley@iee.org>
> Sent: Tuesday, May 28, 2019 4:23 AM
> To: Johannes Sixt <j6t@kdbg.org>; LU Chuck <Chuck.LU@edenred.com>
> Cc: git@vger.kernel.org; chuck.lu@qq.com
> Subject: Re: git filter-branch re-write history over a range of commits did notwork
> 
> Hi Chuck,
> 
> On 27/05/2019 19:21, Johannes Sixt wrote:
> > Am 27.05.19 um 10:01 schrieb LU Chuck:
> >> Hi team,
> >>
> >>      The issue comes from
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_git-2Dfor-2
> Dwindows_git_issues_2206&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGe
> IeOZ_8_zlrQNSboenYltfxGNIXN_qG6VpZgXVRk&m=yFm7lAdkRLNMT058SHQUjM
> RFKzJNDFteXlohKpZHVCs&s=Sm1p3Yoy21xK0_zYBZ5ixLo-Fk3GAsXygC3I6hTZKTg
> &e= .
> >>
> >>      I want to re-write history by filter-branch command over a range of
> commits, but the command did not work.
> >>      I have referred to the following three documentation about how to use
> git filter-branch:
> >>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_ques
> tions_15250070_running-2Dfilter-2Dbranch-2Dover-2Da-2Drange-2Dof-2Dcom
> mits&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGeIeOZ_8_zlrQNSboenYltf
> xGNIXN_qG6VpZgXVRk&m=yFm7lAdkRLNMT058SHQUjMRFKzJNDFteXlohKpZHV
> Cs&s=aYMVqrEjVlsjGZCRbqF3dbPPubv2dtNbGETrEqtO01E&e=
> >>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_ques
> tions_28536980_git-2Dchange-2Dcommit-2Ddate-2Dto-2Dauthor-2Ddate&d=D
> wICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGeIeOZ_8_zlrQNSboenYltfxGNIXN_q
> G6VpZgXVRk&m=yFm7lAdkRLNMT058SHQUjMRFKzJNDFteXlohKpZHVCs&s=RvjO
> jOEXUwzYJp-O3jssuNpmyCWW-UOit8rwFrcKWBE&e=
> >>
> >> https://urldefense.proofpoint.com/v2/url?u=https-3A__git-2Dscm.com_do
> >>
> cs_git-2Dfilter-2Dbranch&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGeIeO
> Z
> >>
> _8_zlrQNSboenYltfxGNIXN_qG6VpZgXVRk&m=yFm7lAdkRLNMT058SHQUjMRFKz
> JNDFt
> >> eXlohKpZHVCs&s=fo6afFNkOm35lefwT8Mq1_LTDW9fJWS7q6dupztiPko&e=
> >>
> >>      You can reproduce the problem by the following steps
> >>      1. clone the repository
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_chucklu_Lee
> tCode_&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGeIeOZ_8_zlrQNSboen
> YltfxGNIXN_qG6VpZgXVRk&m=yFm7lAdkRLNMT058SHQUjMRFKzJNDFteXlohKpZ
> HVCs&s=amNC8CYj-9Nay21ax37eGw_c_92lh0Z6_VK7sTgCwXQ&e=
> >>      2. checkout to the temp branch
> >>      3. run the command git filter-branch --env-filter 'export
> >> GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' ... 67d9d9..f70bf4
> > Did you not tell us everything because you write ... in this message
> > when you cited the command you used, or do you say that you used ...
> > literally in the command?
> 
> 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.

         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."

         Hi team
         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 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.
         I am using the following command to achieve re-write history:
         git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' ... A..E
         However the command did not work.

> >
> >>      4. You will got the info "Found nothing to rewrite"
> >>
> >>      However, it was supposed to overwrite the history from commit 9c1580
> to commit f70bf4, make the commit date same as date.
> >>      I am not sure if I am using the filter-branch correctly, or if there is a bug in
> git?
> >>
> >>      Anyone can help me? Thanks in advance.
> > -- Hannes


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: git filter-branch re-write history over a range of commits did notwork
  2019-05-28  5:42     ` LU Chuck
@ 2019-05-28  6:23       ` Johannes Sixt
  2019-05-28  7:10         ` LU Chuck
  0 siblings, 1 reply; 12+ messages in thread
From: Johannes Sixt @ 2019-05-28  6:23 UTC (permalink / raw)
  To: LU Chuck; +Cc: Philip Oakley, git, chuck.lu

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: git filter-branch re-write history over a range of commits did notwork
  2019-05-28  6:23       ` Johannes Sixt
@ 2019-05-28  7:10         ` LU Chuck
  2019-05-28  9:33           ` Philip Oakley
  0 siblings, 1 reply; 12+ messages in thread
From: LU Chuck @ 2019-05-28  7:10 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Philip Oakley, git, chuck.lu



> -----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.
> 
> >          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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: git filter-branch re-write history over a range of commits did notwork
  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
  0 siblings, 2 replies; 12+ messages in thread
From: Philip Oakley @ 2019-05-28  9:33 UTC (permalink / raw)
  To: LU Chuck, Johannes Sixt; +Cc: git, chuck.lu

Hi Chuck,

On 28/05/2019 08:10, LU Chuck wrote:
[snip]
>> 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 ...?
https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-Theem82308203emthree-dotSymmetricDifferenceNotation
>           "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.
When there is no specific revisions around the three dots then HEAD is 
assumed (to save typing)

[snipping the comments on the alternate script]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: git filter-branch re-write history over a range of commits did notwork
  2019-05-28  9:33           ` Philip Oakley
@ 2019-05-28  9:53             ` LU Chuck
  2019-05-28  9:57             ` Johannes Schindelin
  1 sibling, 0 replies; 12+ messages in thread
From: LU Chuck @ 2019-05-28  9:53 UTC (permalink / raw)
  To: Philip Oakley, Johannes Sixt; +Cc: git, chuck.lu



> -----Original Message-----
> From: Philip Oakley <philipoakley@iee.org>
> Sent: Tuesday, May 28, 2019 5:34 PM
> To: LU Chuck <Chuck.LU@edenred.com>; Johannes Sixt <j6t@kdbg.org>
> Cc: git@vger.kernel.org; chuck.lu@qq.com
> Subject: Re: git filter-branch re-write history over a range of commits did notwork
> 
> Hi Chuck,
> 
> On 28/05/2019 08:10, LU Chuck wrote:
> [snip]
> >> 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 ...?
> https://urldefense.proofpoint.com/v2/url?u=https-3A__git-2Dscm.com_docs_git
> revisions-23Documentation_gitrevisions.txt-2DTheem82308203emthree-2DdotS
> ymmetricDifferenceNotation&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcG
> eIeOZ_8_zlrQNSboenYltfxGNIXN_qG6VpZgXVRk&m=_rDozHXubCFkEsfhMr2QlaP
> n-h_Khfqa3RG0cNmrSxo&s=qdyaJNy6nkAe-4ufeS4o1NdvgoqQQhZDmDjmjQK9k
> Ro&e=
[LU Chuck] Thanks for your documentation about the explanation. Previously I read another documentation https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#Commit-Ranges.  
          It's weird the three dots has two different explanation, maybe there should a place to collect these two explanation for three dots.
> >           "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.
> When there is no specific revisions around the three dots then HEAD is assumed
> (to save typing)
[LU Chuck] I got you here, that's why you ask me remove the three dots before, right?
> 
> [snipping the comments on the alternate script]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: git filter-branch re-write history over a range of commits did notwork
  2019-05-28  9:33           ` Philip Oakley
  2019-05-28  9:53             ` LU Chuck
@ 2019-05-28  9:57             ` Johannes Schindelin
  1 sibling, 0 replies; 12+ messages in thread
From: Johannes Schindelin @ 2019-05-28  9:57 UTC (permalink / raw)
  To: Philip Oakley; +Cc: LU Chuck, Johannes Sixt, git, chuck.lu

Hi,

On Tue, 28 May 2019, Philip Oakley wrote:

> On 28/05/2019 08:10, LU Chuck wrote:
> [snip]
> > > 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 ...?
> https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-Theem82308203emthree-dotSymmetricDifferenceNotation
> >           "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.
> When there is no specific revisions around the three dots then HEAD is assumed
> (to save typing)

From
https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-Theem82308203emthree-dotSymmetricDifferenceNotation:

	The ... (three-dot) Symmetric Difference Notation

	A similar notation r1...r2 is called symmetric difference of r1
	and r2 and is defined as r1 r2 --not $(git merge-base --all r1
	r2). It is the set of commits that are reachable from either one
	of r1 (left side) or r2 (right side) but not from both.

Most importantly, the next paragraph states:

	In these two shorthand notations, you can omit one end and let it
	default to HEAD.

What it does *not* say is that you can leave out both ends, in which case
it becomes the non-sensical short form of `HEAD...HEAD`, as Hannes pointed
out.

Ciao,
Johannes

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: git filter-branch re-write history over a range of commits did notwork
  2019-05-27 18:21 ` Johannes Sixt
  2019-05-27 20:22   ` Philip Oakley
@ 2019-05-28  9:59   ` LU Chuck
  2019-05-29  5:15   ` LU Chuck
  2 siblings, 0 replies; 12+ messages in thread
From: LU Chuck @ 2019-05-28  9:59 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git, chuck.lu



> -----Original Message-----
> From: Johannes Sixt <j6t@kdbg.org>
> Sent: Tuesday, May 28, 2019 2:22 AM
> To: LU Chuck <Chuck.LU@edenred.com>
> Cc: git@vger.kernel.org; chuck.lu@qq.com
> Subject: Re: git filter-branch re-write history over a range of commits did notwork
> 
> Am 27.05.19 um 10:01 schrieb LU Chuck:
> > Hi team,
> >
> >     The issue comes from
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_git-2Dfor-2
> Dwindows_git_issues_2206&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGe
> IeOZ_8_zlrQNSboenYltfxGNIXN_qG6VpZgXVRk&m=PCS1M1ifdx6sA8TMCp7ScKA
> 3-HjUfAajePZfGnQ-94o&s=J7vtNc6IhEcruZJBeCPJJM2XR_zC-1Z0JXmNx9k5c3s&e
> = .
> >
> >     I want to re-write history by filter-branch command over a range of
> commits, but the command did not work.
> >     I have referred to the following three documentation about how to use git
> filter-branch:
> >
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_ques
> tions_15250070_running-2Dfilter-2Dbranch-2Dover-2Da-2Drange-2Dof-2Dcom
> mits&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGeIeOZ_8_zlrQNSboenYltf
> xGNIXN_qG6VpZgXVRk&m=PCS1M1ifdx6sA8TMCp7ScKA3-HjUfAajePZfGnQ-94o
> &s=XZTtPkEqajdcG1uDxiX0AAX7F2Raf0jcubwGTKFtqv0&e=
> >
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_ques
> tions_28536980_git-2Dchange-2Dcommit-2Ddate-2Dto-2Dauthor-2Ddate&d=D
> wICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGeIeOZ_8_zlrQNSboenYltfxGNIXN_q
> G6VpZgXVRk&m=PCS1M1ifdx6sA8TMCp7ScKA3-HjUfAajePZfGnQ-94o&s=6scC0
> PyREzwE67wAerVgPtdO-ng_3Q_M1Ir8sWHXmfs&e=
> >
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__git-2Dscm.com_doc
> >
> s_git-2Dfilter-2Dbranch&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGeIeOZ
> _8
> >
> _zlrQNSboenYltfxGNIXN_qG6VpZgXVRk&m=PCS1M1ifdx6sA8TMCp7ScKA3-HjUf
> AajeP
> > ZfGnQ-94o&s=tWbrczoPb11Ywr7Y7HPO8-LaXWhbqrE4q6iyrCabNsk&e=
> >
> >     You can reproduce the problem by the following steps
> >     1. clone the repository
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_chucklu_Lee
> tCode_&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGeIeOZ_8_zlrQNSboen
> YltfxGNIXN_qG6VpZgXVRk&m=PCS1M1ifdx6sA8TMCp7ScKA3-HjUfAajePZfGnQ-
> 94o&s=G0unMrRQroUK3eE3wu7xBIGH9NbO05ydkFYROKoIcU0&e=
> >     2. checkout to the temp branch
> >     3. run the command git filter-branch --env-filter 'export
> > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' ... 67d9d9..f70bf4
> 
> Did you not tell us everything because you write ... in this message when you cited
> the command you used, or do you say that you used ...
> literally in the command?
[LU Chuck] Let's move back here, I know what three dots does now. According this documentation https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-Theem82308203emthree-dotSymmetricDifferenceNotation .
         Then the command I need to run is git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' 67d9d9..f70bf4 
         But why I got the error message " You must specify a ref to rewrite. ".

         When I use command " git log 67d9d9..f70bf4 ", it will list 4 commits. It means the commits range works.
         So, the problem would be, why the git filter-branch could not recognized 67d9d9..f70bf4 as a range of commits?

> 
> >     4. You will got the info "Found nothing to rewrite"
> >
> >     However, it was supposed to overwrite the history from commit 9c1580 to
> commit f70bf4, make the commit date same as date.
> >     I am not sure if I am using the filter-branch correctly, or if there is a bug in
> git?
> >
> >     Anyone can help me? Thanks in advance.
> 
> -- Hannes

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: git filter-branch re-write history over a range of commits did notwork
  2019-05-27 18:21 ` Johannes Sixt
  2019-05-27 20:22   ` Philip Oakley
  2019-05-28  9:59   ` LU Chuck
@ 2019-05-29  5:15   ` LU Chuck
  2 siblings, 0 replies; 12+ messages in thread
From: LU Chuck @ 2019-05-29  5:15 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git, chuck.lu


> -----Original Message-----
> From: Johannes Sixt <j6t@kdbg.org>
> Sent: Tuesday, May 28, 2019 2:22 AM
> To: LU Chuck <Chuck.LU@edenred.com>
> Cc: git@vger.kernel.org; chuck.lu@qq.com
> Subject: Re: git filter-branch re-write history over a range of commits did notwork
> 
> Am 27.05.19 um 10:01 schrieb LU Chuck:
> > Hi team,
> >
> >     The issue comes from
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_git-2Dfor-2
> Dwindows_git_issues_2206&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGe
> IeOZ_8_zlrQNSboenYltfxGNIXN_qG6VpZgXVRk&m=PCS1M1ifdx6sA8TMCp7ScKA
> 3-HjUfAajePZfGnQ-94o&s=J7vtNc6IhEcruZJBeCPJJM2XR_zC-1Z0JXmNx9k5c3s&e
> = .
> >
> >     I want to re-write history by filter-branch command over a range of
> commits, but the command did not work.
> >     I have referred to the following three documentation about how to use git
> filter-branch:
> >
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_ques
> tions_15250070_running-2Dfilter-2Dbranch-2Dover-2Da-2Drange-2Dof-2Dcom
> mits&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGeIeOZ_8_zlrQNSboenYltf
> xGNIXN_qG6VpZgXVRk&m=PCS1M1ifdx6sA8TMCp7ScKA3-HjUfAajePZfGnQ-94o
> &s=XZTtPkEqajdcG1uDxiX0AAX7F2Raf0jcubwGTKFtqv0&e=
> >
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_ques
> tions_28536980_git-2Dchange-2Dcommit-2Ddate-2Dto-2Dauthor-2Ddate&d=D
> wICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGeIeOZ_8_zlrQNSboenYltfxGNIXN_q
> G6VpZgXVRk&m=PCS1M1ifdx6sA8TMCp7ScKA3-HjUfAajePZfGnQ-94o&s=6scC0
> PyREzwE67wAerVgPtdO-ng_3Q_M1Ir8sWHXmfs&e=
> >
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__git-2Dscm.com_doc
> >
> s_git-2Dfilter-2Dbranch&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGeIeOZ
> _8
> >
> _zlrQNSboenYltfxGNIXN_qG6VpZgXVRk&m=PCS1M1ifdx6sA8TMCp7ScKA3-HjUf
> AajeP
> > ZfGnQ-94o&s=tWbrczoPb11Ywr7Y7HPO8-LaXWhbqrE4q6iyrCabNsk&e=
> >
> >     You can reproduce the problem by the following steps
> >     1. clone the repository
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_chucklu_Lee
> tCode_&d=DwICaQ&c=O17m6UdqOAIZh9XQ8pTl4g&r=VcGeIeOZ_8_zlrQNSboen
> YltfxGNIXN_qG6VpZgXVRk&m=PCS1M1ifdx6sA8TMCp7ScKA3-HjUfAajePZfGnQ-
> 94o&s=G0unMrRQroUK3eE3wu7xBIGH9NbO05ydkFYROKoIcU0&e=
> >     2. checkout to the temp branch
> >     3. run the command git filter-branch --env-filter 'export
> > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' ... 67d9d9..f70bf4
> 
> Did you not tell us everything because you write ... in this message when you cited
> the command you used, or do you say that you used ...
> literally in the command?
[LU Chuck] I find the git filter-branch can't recognize commits range commitA..commitB,
         it can only recognize branchA..branchB. (branchA point to commitA, branchB point to commitB.)
         And you are right, I need remove the useless ... .
         
         So I fixed the previous command as following:
         Create a new branch temp2 point to 67d9d9 and switch to temp branch(point to f70bf4), then it works.
         git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' temp2..temp

         By the way, who can improve the documentation on https://git-scm.com/docs/git-filter-branch? Currently the demo using git filter-branch with commits range commitA..commitB.
         Or anyone can make it possible to support the commit range by commitA..commitB?
> 
> >     4. You will got the info "Found nothing to rewrite"
> >
> >     However, it was supposed to overwrite the history from commit 9c1580 to
> commit f70bf4, make the commit date same as date.
> >     I am not sure if I am using the filter-branch correctly, or if there is a bug in
> git?
> >
> >     Anyone can help me? Thanks in advance.
> 
> -- Hannes

^ permalink raw reply	[flat|nested] 12+ messages in thread

* git filter-branch re-write history over a range of commits did notwork
@ 2019-05-27  8:11 LU Chuck
  0 siblings, 0 replies; 12+ messages in thread
From: LU Chuck @ 2019-05-27  8:11 UTC (permalink / raw)
  To: git; +Cc: chuck.lu

Hi team,

    The issue comes from https://github.com/git-for-windows/git/issues/2206.

 

    I want to re-write history by filter-branch command over a range of commits, but the command did not work.

    I have referred to the following three documentation about how to use git filter-branch:

    https://stackoverflow.com/questions/15250070/running-filter-branch-over-a-range-of-commits

    https://stackoverflow.com/questions/28536980/git-change-commit-date-to-author-date

    https://git-scm.com/docs/git-filter-branch

 

    You can reproduce the problem by the following steps

    1. clone the repository https://github.com/chucklu/LeetCode/

    2. checkout to the temp branch

    3. run the command git filter-branch --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' ... 67d9d9..f70bf4

    4. You will got the info "Found nothing to rewrite"

 

    However, it was supposed to overwrite the history from commit 9c1580 to commit f70bf4, make the commit date same as date.

    I am not sure if I am using the filter-branch correctly, or if there is a bug in git?

 

   Anyone can help me? Thanks in advance.

 

Chuck Lu

Regards

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-05-29  5:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
2019-05-27  8:11 LU Chuck

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git