Git switch: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=Internal= =Overview= Switch to a specific branch, optionally creating it if it does not exist. <syntaxhighlight lang='bash'> git switch develop </syntaxhighlight> <syntax...") |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Internal= | =Internal= | ||
* [[git checkout]] | |||
=Overview= | =Overview= | ||
Line 12: | Line 13: | ||
git switch -c task/experimental | git switch -c task/experimental | ||
</syntaxhighlight> | </syntaxhighlight> | ||
'git switch' and '[[git checkout]]' are equivalent, 'git switch' was introduced with the sole purpose of splitting and clarifying the behavior of 'git checkout', which can be used both to switch to a branch (git checkout <branch-name>) AND to reset files to certain revisions (git checkout -- <path-to-file>). | |||
=Switching from a Detached HEAD Back to the Original State= | |||
<syntaxhighlight lang='bash'> | |||
git switch - | |||
</syntaxhighlight> | |||
Also see: {{Internal|Git_Concepts#Detached_HEAD_Branch|Detached HEAD}} |
Latest revision as of 23:43, 28 May 2021
Internal
Overview
Switch to a specific branch, optionally creating it if it does not exist.
git switch develop
git switch -c task/experimental
'git switch' and 'git checkout' are equivalent, 'git switch' was introduced with the sole purpose of splitting and clarifying the behavior of 'git checkout', which can be used both to switch to a branch (git checkout <branch-name>) AND to reset files to certain revisions (git checkout -- <path-to-file>).
Switching from a Detached HEAD Back to the Original State
git switch -
Also see: