Difference between revisions of "Detached HEAD"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Tags: Mobile web edit, Mobile edit
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{lc}}
  
  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.
+
  [[git checkout]] your-branch
 
   
 
   
  If you want to create a new branch to retain commits you create, you may
+
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.
do so (now or later) by using -c with the switch command. Example:
+
 +
  If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example:
 +
 
 +
[[git switch -c]] <new-branch-name>
 +
 +
Or undo this operation with:
 +
 +
  [[git switch -]]
 +
 +
Turn off this advice by setting config variable [[advice.detachedHead]] to false
 +
 +
[[HEAD]] is now at b4a755e feat: your-text (inm)
 +
 
 +
 
 +
== Related ==
 +
* [[HEAD detached]]
 +
 
 +
== See also ==
 +
* {{git switch}}
 +
* {{git checkout}}
 +
 
 +
[[Category:git]]

Latest revision as of 13:47, 16 March 2023

git checkout your-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.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>

Or undo this operation with:

 git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at b4a755e feat: your-text (inm)


Related[edit]

See also[edit]

Advertising: