Difference between revisions of "Git/checkout"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Git
Jump to navigation Jump to search
m
(git checkout -b)
Line 1: Line 1:
 
==About==
 
==About==
 
The '''git checkout''' command allows you to switch {{l/same|branch}}es. If you've got incomplete changes you want to set aside before switching branches, use '''<code>git {{l/same|stash}}</code>'''.
 
The '''git checkout''' command allows you to switch {{l/same|branch}}es. If you've got incomplete changes you want to set aside before switching branches, use '''<code>git {{l/same|stash}}</code>'''.
 +
 +
==Options==
 +
* <code>git {{l/same|checkout}} -b {{arg|name}}</code> does the same thing as executing these two commands:
 +
** <code>git {{l/same|branch}} {{arg|name}}</code> creates a new branch called "name", pointing at the current {{l/same|HEAD}} revision
 +
** <code>git {{l/same|checkout}} {{arg|name}}</code>  moves {{l/same|HEAD}} to point to the branch called "name"
 +
 
==Links==
 
==Links==
 
===Reference===
 
===Reference===
 
* [https://git-scm.com/docs/git-checkout git-checkout] - Switch branches or restore working tree files
 
* [https://git-scm.com/docs/git-checkout git-checkout] - Switch branches or restore working tree files

Revision as of 16:26, 27 May 2018

About

The git checkout command allows you to switch branches. If you've got incomplete changes you want to set aside before switching branches, use git stash.

Options

  • git checkout -b <name> does the same thing as executing these two commands:
    • git branch <name> creates a new branch called "name", pointing at the current HEAD revision
    • git checkout <name> moves HEAD to point to the branch called "name"

Links

Reference

  • git-checkout - Switch branches or restore working tree files