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

Re: bad git pull

From
Junio C Hamano <junkio@cox.net>
Date
Dec 15, 2005, 23:53 UTC
Message-ID
<7vu0d9lxx9.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vzmn2kjw1.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
Show 15 quoted lines
> Don Zickus <dzickus@gmail.com> writes:
>
>> I notice if I create a branch (and switch to it) in the linux kernel
>> off of say version 2.6.14, then later do a git pull, things get ugly. 
>> It seems like all the upstream changes are being merged into the
>> 2.6.14 branch (instead of the latest kernel tag).
>>
>> Is this a user error because the tool is still fragile?
>
> I do not understand the question.
>
> The user wanted all the good developments from the mainline into
> the fork he created starting at 2.6.14, and the tool did what
> was asked.  Why would you want to forbid that from happening,
> and what did you want to happen instead?

Actually I think I do understand the question. You have a clone of linux-2.6 repository, and your "origin" branch tracks the bleeding edge from Linus. You also have "myhack" branch that was forked off from 2.6.14, and wanted to see what new things Linus has by updating "origin", and perhaps merge those changes into your "master" which keeps track of your hacks based on Linus tip, but unfortunately you were on "myhack" branch.

Ouch.
So what you wanted to do was probably:
	$ git fetch ;# this updates "origin" to Linus tip
instead of
	$ git pull ;# this updates "origin" to Linus tip *and*
                    # merges that into the current branch
As you may probably know, you can recover by
	$ git reset --hard

While I am sympathetic, this "Oops, I said pull when I meant fetch" sounds remotely similar to "oops, I said 'rm -r' when I meant to say 'ls -r'". Is it that the tool is too fragile?

Previous: Junio C HamanoNext: Don Zickus
Message 3 of 22 in “bad git pull”
  1. Don ZickusDec 15, 2005
  2. Junio C HamanoDec 15, 2005
  3. Junio C HamanoDec 15, 2005
  4. Don ZickusDec 16, 2005
  5. Junio C HamanoDec 16, 2005
  6. Carl BaldwinDec 16, 2005
  7. Junio C HamanoDec 16, 2005
  8. Morten WelinderDec 16, 2005
  9. Junio C HamanoDec 16, 2005
  10. Linus TorvaldsDec 16, 2005
  11. Morten WelinderDec 17, 2005
  12. Linus TorvaldsDec 17, 2005
  13. Junio C HamanoDec 17, 2005
  14. Linus TorvaldsDec 17, 2005
  15. Junio C HamanoDec 17, 2005
  16. Nicolas PitreDec 17, 2005
  17. Junio C HamanoDec 18, 2005
  18. Nicolas PitreDec 18, 2005
  19. Linus TorvaldsDec 18, 2005
  20. Junio C HamanoDec 18, 2005
  21. Nicolas PitreDec 18, 2005
  22. Junio C HamanoDec 17, 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.