Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Can we all quietly agree to fix this commit log?

At 18:20 -0800 08 Nov 2013, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
I know all the git doc says never to amend a commit after pushing because
it breaks clones, but I find this version number typo really bothersome.

Is there some procedure we can figure out that gets around that?

commit 375115c7dfd6dff576915d25fe2ecdd381dd9d81

An option that would clean it up somewhat, but without rewriting history would be to create a replacement ref for the mistaken commit.

 # Checking out tag should go into detached HEAD state
 git checkout zsh-5.0.2-test-1
 git commit --amend # Fixup the commit message
 git replace zsh-5.0.2-test-1 HEAD

At that point locally you'd see the amended commit message, unless you ask git to ignore replacement refs (e.g. `git --no-replace-objects log`). But, replace refs are neither pushed nor fetched by default. Pushing can be done with:

 git push remote-name 'refs/replace/*:refs/replace/*'

And anybody who wanted to get the replacement ref
 git fetch remote-name 'refs/replace/*:refs/replace/*'

People could also configure git to push and fetch those refs automatically whenever it's asked to interact with a given remote without being given a refspec.

 git config --add remote.remote-name.push  'refs/replace/*:refs/replace/*'
 git config --add remote.remote-name.fetch 'refs/replace/*:refs/replace/*'

But, the replacement ref would not affect any repository where it wasn't explicitly asked for in some way. It's at least an easy first step. If it's then determined that it isn't good enough, having created the replace ref doesn't really hurt anything; you'd still have the option of rewriting history.

Messages sorted by: Reverse Date, Date, Thread, Author