git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git branch --track to link existing local branch to remote?
@ 2010-05-25 19:40 skillzero
  2010-05-25 19:53 ` Björn Steinbrink
  2010-05-25 19:55 ` git branch --track to link existing local branch to remote? Joshua Jensen
  0 siblings, 2 replies; 4+ messages in thread
From: skillzero @ 2010-05-25 19:40 UTC (permalink / raw)
  To: Git Mailing List

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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-26  8:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25 19:40 git branch --track to link existing local branch to remote? skillzero
2010-05-25 19:53 ` Björn Steinbrink
2010-05-26  8:46   ` [PATCH] completion: --set-upstream option for git-branch Michael J Gruber
2010-05-25 19:55 ` git branch --track to link existing local branch to remote? Joshua Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).