Git switch: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 14: Line 14:
</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>).
'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>).

Revision as of 00:55, 3 December 2020

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>).