Entry tags:
Your branch is ahead of 'upstream/develop' by 540 commits.
~/dw (develop)$ git status
# On branch develop
# Your branch is ahead of 'upstream/develop' by 540 commits.
Did we ever figure out what causes this? I have a theory, but I don't really understand...
(Theory: the dwu script does "git pull --ff-only upstream develop" straight from the remote repo into the local develop branch. This doesn't update the local copy of "remotes/upstream/develop" that was created by a "git fetch" sometime in the past. This is what the current branch is being compared to. I have no idea whether this makes sense, and if so how to deal with it...)
# On branch develop
# Your branch is ahead of 'upstream/develop' by 540 commits.
Did we ever figure out what causes this? I have a theory, but I don't really understand...
(Theory: the dwu script does "git pull --ff-only upstream develop" straight from the remote repo into the local develop branch. This doesn't update the local copy of "remotes/upstream/develop" that was created by a "git fetch" sometime in the past. This is what the current branch is being compared to. I have no idea whether this makes sense, and if so how to deal with it...)
no subject
Is your upstream remote the canonical DW repo, or your fork of it? If it's your fork, you'll occasionally need to pull from the former and push back to the latter to keep them in sync. I don't use the "dwu" script so I have no idea if or how it handles that situation, but that might be what's going on?
no subject
Doing a pull includes fetching for *that specific branch* that is specified - but I don't think it will update all the various "remote/*/*" branches that a plain "git fetch" does. AIUI.
And yes, on my setup, upstream = dw-free, origin = my fork of it.
no subject
I think kar has p.much nailed it -- for some reason, your upstream remote isn't getting updated with changes from dreamwidth. Bear with me while I think out loud:
"Your branch is ahead of '[remote]/[branchname]' by 540 commits" is Git's funny way of saying that, according to its current state of knowledge, your local branch currently has 540 commits that aren't present on the remote. Conversely, when Git says your branch is behind, your local branch is missing commits that are present on the remote. (And hilariously enough, it's possible to be both "ahead" and "behind" at the same time...)
When you pull commits into your local branch from dreamwidth, your local branch moves ahead of your forked branch on Github -- your local branch now has all those changes from the mainline of DW development, but your branch on Github doesn't have them yet. So if you have your branch on Github set up as the remote named 'origin', then after a pull from dreamwidth, git push origin develop will send all those commits over to it, making its contents the same as your local branch. And every time you pull in an update from dreamwidth, you'll have to push those new commits back to origin to avoid seeing the "x commits ahead" message.
I'm not sure which version of the dwu script you've got -- it's changed over time -- but the current one in the wiki does push back to the remote named 'origin'. It fetches from the remote named 'dreamwidth'. Do you by chance have a third remote named 'upstream'? If so, that might explain why 'upstream' is always behind -- it's never getting updated.
To see what remotes you have and what they're pointed at, try git remote -v:
Then you can see how the local↔remote branches are wired up for a specific remote with git remote show <remotename>:
no subject
no subject
Thanks, but I'm afraid I explained poorly. My upstream remote *is* dreamwidth. I put my dwu together when we first switched to git, so some of the names are different, but I've just checked and to all intents and purposes it's the same as the current version on the wiki, except that what that calls "dreamwidth" I call "upstream".
no subject
https://gist.github.com/swaldman3/6482639
(small differences are there because I put in a "put me back on the branch I started on" mechanism before the version in the wiki had that, and because I have a different name for the dreamwidth repo)
no subject
The important thing here is that there are *four* different versions of (say) develop. We don't care about the version on origin, which is my github fork, but the other three:
So what I think is happening is that,
This would explain why running git fetch makes the message go away for a while,and would explain why I get this message while not having any actual problems in working (because the branch that I actually work on is up to date).
The problem may not have been seen very much (although I'm pretty sure I'm not the only one) because somebody who always uses git fetch won't see it,and somebody who has only ever used the dwu script won't see it either.
Or, have I totally misunderstood how the remotes/* branches work?
no subject
Is this happening on your Dreamhack, by chance? If so, d'you mind if I take a look at your git repository there and see if I can figure out what's going on?
no subject
Yes, it's on my dreamhack, and feel free to have a look if you have the time. My username there is dh-swaldman.
no subject
ETA: Aha, okay, git pull --ff-only is not equivalent to fetch + merge, "it doesn't fetch all upstream commits (just the ones for the branch you're working on)". (Unfortunately the reference for this is a StackOverflow question with an agenda, not official documentation, but oh well.)
no subject
I'm unable to actually check anything at present, though, because this hotel's "free wifi" blocks SSH....
no subject
I was right in what was going on, but the "official" script doesn't do this because it does a "git fetch" at the start, thus updating all the remote branches.
Once it's done this, it then does "pull" for develop and master, which means looking at them in the upstream repo again for no particular reason...
Proposal: In the official script, change lines of the form
"git pull --ff-only dreamwidth develop"
to the form
"git merge --ff-only remotes/dreamwidth/develop".
I've just tried this (with dreamwidth substituted with upstream for my setup) and it seems to work, and it should mean hitting github less often.
Also, the "git fetch" should probably be changed to "git fetch -p" so that any branches removed from the dreamwidth github repo are also removed locally.
Asking here rather than just changing it in the wiki it in case there's a reason not to :-)
no subject
If you're still unsure, make a new top-level post to see if anyone else has any objections :)
no subject
no subject
Might those issues have been around the difference that I was describing? (that fetch gets all branches)
no subject
no subject
Remote branches:
develop tracked