19

I have done a replacement of one commit with another in this way:

* HEAD
|
...
|
* ==> *  `git replace left_commit right_commit`
|     |
*-----/
|
...

This replacement is placed in .git/refs/replace folder, so I wonder - how can I push this refs to the remote end?

abyss.7
  • 13,882
  • 11
  • 56
  • 100
  • Interesting question. I found this http://git-scm.com/blog/2010/03/17/replace.html and tried to follow it on a sample project. In the end I tried to `git push -f` but in my remote repository I did not see the replacing commit (I just reword a commit on history). Can you confirm that `git push -f` does not push to upstream the replacing? – ThanksForAllTheFish Nov 19 '13 at 11:26

1 Answers1

22

Found the answer in mailing-list:

git push origin 'refs/replace/*'
git fetch origin 'refs/replace/*:refs/replace/*'

Only explicit pushing and fetching do work right now in git.

abyss.7
  • 13,882
  • 11
  • 56
  • 100