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

Re: branch ahead in commits but push claims all up to date

From
John Tapsell <johnflux@gmail.com>
Date
Mar 26, 2009, 02:05 UTC
Message-ID
<43d8ce650903251905p6f9798f5u79be7dff3b118d5c@mail.gmail.com>
In-Reply-To
<7001b7a00903251023r1ce5cc0dnb29b7f9379408c42@mail.gmail.com>
2009/3/25 Irene Ros <imirene@gmail.com>:
Show 7 quoted lines
> Hi Daniel,
>
> Thank you for the explanation, doing a git fetch actually did do the
> trick although I still don't quite see the difference between
> git pull origin myBranch
> and
> git fetch
git pull origin myBranch    is equivalent to two commands:

git fetch git merge origin/myBranch

(so fetch actual remote repository to local remote repository. Then do the merge)

Show 6 quoted lines
>
> When I push to origin myBranch it's clear that it actually pushes my
> changes to our remote repository since others can then pull and get
> them. So is it the case that:
>
> git push ==> actual remote repository
Yes
> while
> git pull <== local copy of remote repository for this branch ?

git pull <== actual remote repository copied to local copy of remote repository. Then local copy of remote repository merged into your branch.

Show 5 quoted lines
> In that case why is it that in all branches that I have, besides this
> one, doing a 'git pull origin whateverBranch' actually pulls from the
> remote branch and not the local copy? This case has been quite unique
> given dozens of branches that we constantly switch to and from. We've
> never actually used (or clearly saw the need for) git fetch until now.

If you always git pull after git push, then you'll have no problem, since git pull also does a git fetch.

git is sometimes a bit too bare bones :-/ It would be nice to try to hide these implementation details better

Previous: Santi BéjarNext: Björn Steinbrink
Message 12 of 13 in “branch ahead in commits but push claims all up to date”
  1. Irene RosMar 24, 2009
  2. Junio C HamanoMar 24, 2009
  3. John TapsellMar 24, 2009
  4. Daniel BarkalowMar 24, 2009
  5. John TapsellMar 25, 2009
  6. Daniel BarkalowMar 25, 2009
  7. Irene RosMar 25, 2009
  8. John TapsellMar 25, 2009
  9. Daniel BarkalowMar 25, 2009
  10. Irene RosMar 25, 2009
  11. Santi BéjarMar 25, 2009
  12. John TapsellMar 26, 2009
  13. Björn SteinbrinkMar 26, 2009

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.