Git quick reference

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
(half of a recipe for pulling a remote branch)
(How to determine remote branches)
Line 11: Line 11:
  
 
=== Switch to a branch that was pushed remotely ===
 
=== Switch to a branch that was pushed remotely ===
Guess the name of the remote branch then run:
+
Use:
 +
 
 +
<code>git branch -a</code>
 +
 
 +
to determine the name of the remote branch you want to work on.  Remote branches will be preceded by <code>origin/</code>.  Then use this to switch to it:
  
 
<code>git checkout -b <branch> origin/<branch></code>
 
<code>git checkout -b <branch> origin/<branch></code>

Revision as of 20:03, 6 October 2008

Warning (medium size).png
Quick Reference Only
This is not intended to be an exhaustive list of git operations. See the documentation for that.

Contents

Basic Operations

Developer Operations

Create a new local branch

git checkout -b <branch>

Push and create a new remote branch from an existing local branch of the same name

git push origin <branch>

Switch to a branch that was pushed remotely

Use:

git branch -a

to determine the name of the remote branch you want to work on. Remote branches will be preceded by origin/. Then use this to switch to it:

git checkout -b <branch> origin/<branch>

Maintainer Operations

Apply mailed git patch

git am <file>