Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I make a new local branch track the same remote branch as the local branch it's created from?
    primarykey
    data
    text
    <p><strong>Short Version:</strong> </p> <p>I want to create a local branch (B) from a local branch (A) and make it track the same remote branch that (A) is tracking. How could I do that in one command? Is there any way I could set this behavior as default?</p> <p><strong>Full Explanation:</strong></p> <p>I've recently converted from using git-svn to "pure" git. There's an aspect of my workflow that has been really frustrating, and I'm trying to figure out a way to restore that workflow. Here is how it was with git-svn:</p> <ul> <li>Create a new local branch (A) that tracks a remote branch (X)</li> <li>Do some work, make some local commits.</li> <li><code>git svn rebase</code> -- A is rebased up to the HEAD of X</li> <li>Do some work, make some local commits.</li> <li>Have an offshoot idea, make a new local branch (B) from (A)</li> <li>Do some work, make some local commits.</li> <li><code>git svn rebase</code> -- B is rebased up to the HEAD of X</li> <li>etc.</li> </ul> <p>In the pure git world, the problem I'm having is that while (A) tracks the remote branch, (B) does not inherit that. I'm aware that I can explicitly set this, by doing <code>git branch --set-upstream (B) (X)</code>. What I am looking for is a way for this tracking behavior to be inherited automatically, so I don't have to remember to do this, and then get all frustrated when my <code>git pull --rebase</code> doesn't work on (B).</p> <p>I realize that the "problem" with this is that it can lose the heritage of (B) having been made from (A). I just don't care about that.</p> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload