{"thread":{"id":"27429","subject":"Using git-replace to edit a commit message?","startedAt":"2011-05-22T22:11:39Z","lastAt":"2011-05-23T02:11:41Z","messageCount":2,"participants":["Joe Smith","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"168458","messageId":"loom.20110523T001117-737@post.gmane.org","threadId":"27429","inReplyTo":null,"subject":"Using git-replace to edit a commit message?","fromName":"Joe Smith","fromEmail":"unknown_kev_cat@hotmail.com","sentAt":"2011-05-22T22:11:39Z","receivedAt":"2011-05-22T22:11:39Z","isPatch":false,"sender":{"key":"unknown_kev_cat@hotmail.com","avatar":null},"body":"\nA somewhat common question with Git is how to change a commit message of an\nalready created commit. \n\nWhen this question comes up, the most common case is an unpublished commit,\nwhich can safely be corrected by re-writing history.\n\nOccasionally the question is about a published commit. Sometimes even for\npublished repositories rewriting history is acceptable, but often it is not.\nIn that case the usual answer is either: there is nothing you can do without\nrewriting history, or add a note to the commit.\n\nIs that really true?\n\nIt occurs to me that the following procedure should work rather well for\nthis, as long as it is not a frequent occurrence.\n\nCreate a new commit object with the correct text (or correct author,\nor correct committer), ensuring that the the listed tree and parent\nSHA-1 hashes are correct (i.e. are the same those hashes in the commit\nbeing \"edited\").\n\nThen simply use git-replace to have all references to the \"unedited\"\ncommit instead use this new commit.\n\nIs there some reason that will not work? If it would work, is there\nsome reason nobody ever seems to suggest it?\n"},{"id":"168475","messageId":"7vpqnaw4gy.fsf@alter.siamese.dyndns.org","threadId":"27429","inReplyTo":"loom.20110523T001117-737@post.gmane.org","subject":"Re: Using git-replace to edit a commit message?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-05-23T02:11:41Z","receivedAt":"2011-05-23T02:11:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Joe Smith <unknown_kev_cat@hotmail.com> writes:\n\n> Is there some reason that will not work? If it would work, is there\n> some reason nobody ever seems to suggest it?\n\nIt would; I think the real reason is because it is not worth the trouble\nfor asking everybody to trust your replace refs and install them in their\nrepository and pay the runtime cost. Most people just move on once their\nmistakes are public.\n"}]}