简体   繁体   English

如何提交特定的git版本?

[英]How to commit in a specific git revision?

I would like to commit my changes for a bug fix in an older revision, in which I committed other changes for the same bug, so that the history is organized. 我想对旧版本中的错误修复进行更改,在该版本中,我针对同一错误进行了其他更改,以便组织历史记录。 I mean like an amend commit, but this one commits in the last revision, not in an older one. 我的意思是像一个修订提交,但是此修订在上一个修订版本中提交,而不是在较旧的版本中。 How could it be possible to do that? 怎么可能做到这一点?

Commit the fix, then use git rebase -i OLDER . 提交修复程序,然后使用git rebase -i OLDER You can then reorganize the commits in the editor to move your new fix up with all of the old ones. 然后,您可以在编辑器中重新组织提交,以将所有新修订与所有旧修订一起上移。

This will rewrite all of the history in that range, so if you have pushed these changes anywhere you will be causing trouble for everyone else. 这将重写该范围内的所有历史记录,因此,如果将这些更改推到任何地方,都会给其他所有人带来麻烦。 This is the kind of thing you do only in your own topic branch in your private repository before submitting changes to an upstream or merging the project branch back to the trunk. 您只能在私有存储库中自己的主题分支中执行此操作,然后再将更改提交给上游或将项目分支合并回主干。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM