git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: rsync update appears broken now

From
Junio C Hamano <junkio@twinsun.com>
Date
Oct 20, 2005, 20:48 UTC
Message-ID
<loom.20051020T220751-355@post.gmane.org>
In-Reply-To
<Pine.LNX.4.64.0510201038320.3369@g5.osdl.org>
Linus Torvalds <torvalds <at> osdl.org> writes:
> For those of us who have a separate branch to track the original (I call 
> mine "parent), this tells the story:
> 
> 	* refs/heads/parent: does not fast forward to branch 'master' of
master.kernel.org:/pub/scm/git/git;
> 	  not updating.
Yes, I screwed up.  One honest mistake and another stupid one.

Note that "those of us" above include everybody who did "git-clone" to set up the repository and left the default "Pull: master:origin" line in .git/refs/remotes/origin.

> Junio, please don't do that. It really screws people up. Now people can't 
> fetch your head any more, and can't track you, because your branch isn't 
> stable any more.

Sorry, and yes that was the "honest mistake" part. I know I should never rewind beyond what I already have pushed out, and usually I carefully follow that rule.

But this time I forgot that I pushed something out and also failed to re-check what I pushed out before rewinding (the check is done by fetching from master.kernel.org myself).

And another stupid mistake part was when I pushed out the result. send-pack correctly refused to update the master side, but I forced it without much thinking.

Sorry about these mistakes.

Having said that, all is not lost. Your message made it sound like the new head was completely re-rooted and there is no common commit (which almost gave me a heart attack), but I do not think it is that bad. It is more like pulling from two places.

               -----(A) head merlyn and everybody
             /          pulled from kernel.org previously
  --- common ------------------------------------(B) head rebased and pushed
                                                     out by mistake

The "parent" head you described in your message is A above, and what is on kernel.org is B. A is known as "origin" in the default setup git-clone makes.

If you have *no* further development on top of (A), the recovery is simple.
   $ git checkout master ;# make sure you are on your "master" branch.
   $ git fetch origin +master:origin ;# force "origin" to be (B)
   $ git reset --hard origin ;# reset your "master" branch to (B)
If you had any further development on top of (A), then the graph would look
like:
               -----(A)---------------(X) your tip
             /
  --- common ----------------------(B)

The merge conflict message you got when you pulled is result of trying to merge (X) and (B).

There are two things we could do.
One is to forward port your changes between (A) and (X) on top of (B):
   $ git checkout master ;# make sure you are on your "master" branch.
   $ git tag anchor-a origin ;# stash (A) away
   $ git fetch origin +master:origin ;# force "origin" to be (B)
   $ git checkout -b rescue-stupid-junio origin
   $ rm -fr .dotest
   $ git format-patch -k --stdout anchor-a..master | git am -k -3

Depending on the changes between A and X, forward porting may result in conflicting/unapplicable patches. The individual changes are found in .dotest/ directory and you can re-run 'git am -i' after fixing up the conflicts.

Then validate the tip of the result to make sure forward porting did not lose your changes:

   $ git diff origin..rescue-stupid-junio
If the result look OK, then we can make this your master branch.
   $ git checkout master
   $ git reset --hard rescue-stupid-junio
and clean things up by
   $ rm -f .git/refs/tags/anchor-a
   $ git branch -d rescue-stupid-junio

Another thing we could do is to treat as if this stupid maintainer briefly had a twin who did concurrent development, and merge (X) and (B).

   $ git checkout master
   $ git pull origin +master:origin

This, as Merlyn and you saw, probably would result in merge conflicts which need to be resolved manually.

Unfortunately I do not have access right now to commits between "common" and (A) in the above picture (I am at work), so I cannot try any of the above out myself.

Previous: Linus TorvaldsNext: Linus Torvalds
Message 6 of 21 in “rsync update appears broken now”
  1. Randal L. SchwartzOct 20, 2005
  2. Alex RiesenOct 20, 2005
  3. Randal L. SchwartzOct 20, 2005
  4. Alex RiesenOct 20, 2005
  5. Linus TorvaldsOct 20, 2005
  6. Junio C HamanoOct 20, 2005
  7. Linus TorvaldsOct 20, 2005
  8. Junio HamanoOct 20, 2005
  9. Johannes SchindelinOct 20, 2005
  10. Linus TorvaldsOct 20, 2005
  11. Johannes SchindelinOct 21, 2005
  12. Linus TorvaldsOct 21, 2005
  13. Petr BaudisOct 21, 2005
  14. Linus TorvaldsOct 20, 2005
  15. Junio C HamanoOct 21, 2005
  16. Linus TorvaldsOct 21, 2005
  17. Randal L. SchwartzOct 21, 2005
  18. Linus TorvaldsOct 21, 2005
  19. Morten WelinderOct 20, 2005
  20. dave morganOct 20, 2005
  21. Stephen C. TweedieOct 20, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.