git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Pushing a new branch to a remote and tracking it

From
Bradley Wagner <bradley.wagner@hannonhill.com>
Date
Jul 27, 2010, 22:12 UTC
Message-ID
<AANLkTikxmhndNqGDpwfBm41OuaPvnB=2xqp6gkYOTQiF@mail.gmail.com>

Is there a more elegant way to: 1) create a branch, 2) push it to a remote and 3) continue to track it.

I noticed that:

git branch <branchname> HEAD git checkout <branchname> git push origin <branchname>

does not link the local branch to the remote.
I've seen other people do:

git push origin origin:refs/heads/<branchname> git fetch origin git branch -r (verify that the branch is there) git checkout <branchname> -b origin/<branchname>

but it seems kind of the reverse of what I would expect to do. I know I could also do the first thing and then delete/re-checkout the branch with tracking.

Next: Andreas Schwab
Message 1 of 3 in “Pushing a new branch to a remote and tracking it”
  1. Bradley WagnerJul 27, 2010
  2. Andreas SchwabJul 27, 2010
  3. Bradley WagnerJul 28, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.