threads / discuss / 20096

Rewrite history then pull repository?

Subject: Rewrite history then pull repository?

## tl;dr

3 messages between Jul 13, 2009 and Jul 13, 2009.

replies: 2people: 2as markdown or json

Graeme Geldenhuys· Jul 13, 2009, 08:42 UTC · lore
Hi,

I pushed a repository to Github (a mirror of SubVersion repository). I then had some screwup with 'git svn rebase' when I should have used 'git svn fetch'. Anyway I managed to fix the issue locally and then forced the push to GitHub. This rewrote the history for the HEAD commit and gave it a different date and SHA1.

What will now happen to developers that cloned the repository before the 
  history rewrite and then do a 'git pull' after the history rewrite? 
Will git automatically sort out the mess, or is it going to post some 
warning? The content of that screwed up commit stayed exactly the same, 
only the date of the commit changed which then generated a different SHA1.
If a warning, what must they do to resolve the issue on there PC's?
Regards,
   - Graeme -
-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/
Thomas Rast· Jul 13, 2009, 08:58 UTC · re: Graeme Geldenhuys · lore

Re: Rewrite history then pull repository?

Graeme Geldenhuys wrote:
Show 9 quoted lines
> 
> I pushed a repository to Github (a mirror of SubVersion repository). I 
> then had some screwup with 'git svn rebase' when I should have used 'git 
> svn fetch'.  Anyway I managed to fix the issue locally and then forced 
> the push to GitHub. This rewrote the history for the HEAD commit and 
> gave it a different date and SHA1.
> 
> What will now happen to developers that cloned the repository before the 
>   history rewrite and then do a 'git pull' after the history rewrite? 

See the "Recovering From Upstream Rebase" section in man git-rebase, also available online at

  http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html

(especially useful if your local git is older than 1.6.1 and doesn't have this section yet).

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Graeme Geldenhuys· Jul 13, 2009, 09:38 UTC · re: Thomas Rast · lore

Re: Rewrite history then pull repository?

Thomas Rast wrote:
> 
> See the "Recovering From Upstream Rebase" section in man git-rebase,
> also available online at

Thanks for the link. Luckily I had a clone (backup) of my repository before the upstream rebase. So I could play around and see what happens to developers downstream. I used the 'gitk --all' to see the history and visualize what I had to do. I managed to figure out that 'git rebase origin' would solve the problem, and the documentation you mentioned confirmed that. :-)

Thanks again for the quick reply.
Regards,
   - Graeme -
-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

← back to recent threads