svn switchcommand and git has an equivalent. It's relatively easy in git to change your upstream - once you know how - so don't be tempted to just delete your local repo and re-clone! We can do better than that :) Continue reading
I think it's a pretty well-rounded collection and it's only $99 for a couple of weeks, so get the PHP Learning Path here and let me know what you think?
git pulland expect a fast-forward update, but get a merge instead, don't panic! This usually happens when we're collaborating on a branch with other people, and we've made changes on our local version of a branch, and someone else (or the other you, if you use git to sync between multiple dev platforms) has made changes to the remote version of a branch in the meantime. It also happens really frequently in teams where all commits are to the
masterbranch ... yet another reason to have a decent branching strategy.
All that's happened is something like this:
$ git log --oneline --all --graph --decorate * 054f163 (HEAD, branch1) Installation instructions for the application | * 0ce808c (origin/branch1) Fixing template layout |/ * 927aad9 A random change of 731 to ideas2.txt
Since the last common commit, there are commits on your local branch, and the remote one. You could just let the merge go ahead but there are other options. You could also check out a new branch at this point, reset your tracking branch to the right place and then reapply your changes using cherry-pick or by rebasing and then fast-forward merging your branch. Continue reading
git log --numstat will show you how many lines were added (first column) and removed (next column) per file, kind of a more scientific version of the
--stat switch. And if you're thinking of scripting this to gather stats, try it with
--oneline as well, it's easier to parse.
Your branch is based on 'origin/master', but the upstream is gone. (use "git branch --unset-upstream" to fixup)
I was delivering a workshop at the time so I kinda snarled at it and carried on with what I was doing, but later I looked up what is happening. This occurs when a branch is tracking a branch that the git repo doesn't have any information about - the branches to be tracked aren't in the local repo metadata.
In my case, it happened because I had created and then cloned an empty repo for training purposes - so
origin/master didn't actually exist yet! I added a quick commit-and-push to my script and hope that I won't be upstaged by this change that came in with git 1.8.5.
Hopefully this post will help someone else to avoid being upstaged or irritated by this as well!