edit问题归结为“可以git rebase
也被指示对标签进行变基吗?”但是对最初问题的回答也会有所帮助。
Asking 如何将过去添加到 git 存储库中? https://stackoverflow.com/questions/3147097/how-to-prepend-the-past-to-a-git-repository我跟着这些说明 https://stackoverflow.com/questions/3147097/how-to-prepend-the-past-to-a-git-repository/3148117#3148117. <edit>然后我重新调整基准以包含仅在快照中的文件,请参阅here https://stackoverflow.com/questions/3150394/how-to-undelete-a-file-previously-deleted-in-gits-history/3150528#3150528.</edit> 自从历史被改写(由git filter-branch
or git rebase
或者两者都?)所有标签仍然在原始时间线上*,我想以某种方式将它们移动到新时间线上。我想我使所有带有标签的提交消息都是唯一的,所以我可以尝试编写一个使用它们的脚本,但更通用git move-tags <from> <to>
会更好。
那么,有没有办法解决“新时间线上的 N 个提交之后,旧时间线上的第 N 个提交被标记”的问题?除了明显的手动重新标记之外,任何其他解决方案也都很棒。
(请随意将这个可怕的长句子改成简单的英语......)
*) 嘿,解决了祖父悖论!
我写了一个脚本来执行此操作。
$ 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 http://gist.github.com/908381.
但更好的是,使用--tag-name-filter
选项内置于 git-filter-branch(1)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)