Difference between revisions of "Git switch --create / -c"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{lc}}
 
{{lc}}
 +
* Switch to a specified branch. https://git-scm.com/docs/git-switch
  
  [[git switch]] -c [[main]]
+
[[git switch]] --create [[your_new_branch]]
 +
  [[git switch]] -c [[your_new_branch]]
  
 +
 +
 +
You are in '[[detached HEAD]]' state. You can look around, make experimental
 +
changes and commit them, and you can discard any commits you make in this
 +
state without impacting any branches by switching back to a branch.
 +
 +
 +
 +
[[Move existing, uncommitted work to a new branch in git]]
  
 
== See also ==
 
== See also ==
 
* {{git switch}}
 
* {{git switch}}
 
* {{git branch}}
 
* {{git branch}}
 +
 +
[[Category:Git]]

Latest revision as of 11:07, 19 January 2024

git switch --create your_new_branch
git switch -c your_new_branch


You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.


Move existing, uncommitted work to a new branch in git

See also[edit]

Advertising: