Web lists-archives.com

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





> -----Original Message-----
> From: Philip Oakley <philipoakley@xxxxxxx>
> Sent: Tuesday, May 28, 2019 4:23 AM
> To: Johannes Sixt <j6t@xxxxxxxx>; LU Chuck <Chuck.LU@xxxxxxxxxxx>
> Cc: git@xxxxxxxxxxxxxxx; chuck.lu@xxxxxx
> 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