git branch --track to link existing local branch to remote?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Is there a way to link a local branch, which already exists, to a
remote branch without editing the git config file? I create a local
repository and committed some changes, created a remote repository,
added the remote to the local repository, and then pushed the local
branch to the remote. Now the local master points to the same commit
as origin/master. However, the branches aren't linked in the config
file so I can't just do git pull.

I know I can manually edit the config file (as the error message on
git pull says), but it seems like 'git branch --track master
origin/master' should do that automatically, especially if both
branches point to the same commit. It currently complains that the
branch master already exists and -f doesn't let me replace the current
branch. So what I've had to do is create a temp branch, switch to it,
do git branch -f --track master origin/master, and then delete the
temp branch. Is there a better way?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]