Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>A <strong>local branch</strong> is a branch that only you (the local user) can see. It exists only on your local machine.</p> <pre><code>git branch myNewBranch # Create local branch named "myNewBranch" </code></pre> <p>A <strong>remote branch</strong> is a branch on a remote location (in most cases <code>origin</code>). You can push the newly created local branch <code>myNewBranch</code> to <code>origin</code>. Now other users can track it.</p> <pre><code>git push -u origin myNewBranch # Pushes your newly created local branch "myNewBranch" # to the remote "origin". # So now a new branch named "myNewBranch" is # created on the remote machine named "origin" </code></pre> <p>A <strong>remote tracking branch</strong> is a local copy of a remote branch. When <code>myNewBranch</code> is pushed to <code>origin</code> using the command above, a remote tracking branch named <code>origin/myNewBranch</code> is created on your machine. This remote tracking branch tracks the remote branch <code>myNewBranch</code> on <code>origin</code>. You can update your <strong>remote tracking branch</strong> to be in sync with the <strong>remote branch</strong> using <code>git fetch</code> or <code>git pull</code>.</p> <pre><code>git pull origin myNewBranch # Pulls new commits from branch "myNewBranch" # on remote "origin" into remote tracking # branch on your machine "origin/myNewBranch". # Here "origin/myNewBranch" is your copy of # "myNewBranch" on "origin" </code></pre> <p>A <strong>local tracking branch</strong> is a <strong>local branch</strong> that is tracking another branch. This is so that you can push/pull commits to/from the other branch. Local tracking branches in most cases track a remote tracking branch. When you push a local branch to <code>origin</code> using the <code>git push command</code> with a <code>-u</code> option (as shown above), you set up the local branch <code>myNewBranch</code> to track the remote tracking branch <code>origin/myNewBranch</code>. This is needed to use <code>git push</code> and <code>git pull</code> without specifying an upstream to push to or pull from.</p> <pre><code>git checkout myNewBranch # Switch to myNewBranch git pull # Updates remote tracking branch "origin/myNewBranch" # to be in sync with the remote branch "myNewBranch" # on "origin". # Pulls these new commits from "origin/myNewBranch" # to local branch "myNewBranch which you just switched to. </code></pre>
 

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