Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
444 views
in Technique[技术] by (71.8m points)

history - Can tags be automatically moved after a git filter-branch and rebase?

edit The question boils down to "Can git rebase be instructed to rebase tags, too?" But an answer to the original question would also help.


Asking How to prepend the past to a git repository? I followed these instructions. <edit>Then I rebased to include a file that was only in the snapshots, see here.</edit> Since history was rewritten (by git filter-branch or git rebase or both?) all tags are still on the original time line* and I'd somehow like to move them to the new one. I think I made all commit-messages with tags unique so I could try writing a script that uses them, but a more general git move-tags <from> <to> would be better.

So, is there a way to address "the commit which is N commits after on the new timeline such that the Nth commit after on the old timeline is tagged "? Any other solution except the obvious manual retagging would also be great.

(please feel free to correct that horribly long sentence into plain English...)

*) hey, git solved the grandfather-paradox!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I’ve written a script that does this.

$ git-rebase-tags master
Rebasing 107 tags onto 'master'
Can't rebase tag 'staging-deploy-01' because there are no identical commits on 'master'
Pointed tag 'v0.0.11' at commit 81e16f2ca1bc7802547bf19c1dba1a68212eafff
Pointed tag 'v0.0.12' at commit 17051cc28084dd56ae56e96767bceee46217c02d
Pointed tag 'v0.0.13' at commit 5d795076ba4b33f81d327dcf9bff727cef7771a2
[...]

See gist.github.com/908381.

But even better, use the --tag-name-filter option built into git-filter-branch(1).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...