I have the following branches (local and remote):
origin/master
origin/alter
origin/alter_old
master
alter
alter_old
If I do git branch -vv I get:
master 6aec3b5 [origin/master] blam
alter 8c32a03 blaa1
alter_old 1669af7 [origin/alter: ahead N, behind M] blaa2
I want alter to track origin/alter and alter_old to track origin/alter_old. How can I do it? I tried the following:
git checkout alter_old
git branch -u origin/alter_old
but I get:
error: unknown switch `u'
And the same for --set-upstream-to.
EDIT: Strangely, I think that when I push, alterpushes into origin/master and alter_old pushed to origin/alter_old. Why is this?
For git 1.8.0 onwards
OR
For git 1.7.0 : Use
--set-upstreaminstead of--set-upstream-to