当前位置: 动力学知识库 > 问答 > 编程问答 >

version control - Can I edit the message of an older revision in Bazaar?

问题描述:

How can I edit an older revision's message to more correctly describe its changes?

网友答案:

You cannot edit the commit message of an old revision without changing the revision id of the modified revision and all its descendants.

Well... technically you can, if you try hard enough, but the technical term for the result is "corrupt repository". A repository in bzr is a replica of a distributed database of revisions, and if all replicas don't agree on the content of a revision, you have an integrity violation. Meaning, all bets are off, and the system will actively try to detect such situations and refuse to work.

To modify the commit message of the last revision in a branch, you can use "bzr uncommit", followed by "bzr commit" with the new commit message.

To modify the commit message of an older revision, you get a branch whose last revision you want to modify, use "uncommit" then "commit", and re-attach the subsequent revisions using "bzr rebase" or "bzr replay" (from the "rewrite" plugin).

In every case, that will produce a branch which is considered "divergent" from the one you had initially. If the initial branch was published, your original revisions can come back to cause painful merges, history pollution, and generally haunt you.

网友答案:

No, you can't edit commit messages for older revisions. Revisions in Bazaar are immutable. You would have to reconstruct the branch from the revision you have to change.

网友答案:

if it was the revision you last committed, you can bzr commit --unchanged to add something to the log. that isn't what you want, but it might be the next best thing if ddaa's warnings matter to you.

分享给朋友:
您可能感兴趣的文章:
随机阅读: