結帳時,我收到以下訊息:
$ git checkout HEAD~2
Note: switching to 'HEAD~2'.
You are in a '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 that 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 -
中的破折號是什么意思git switch -?它總是前一個分支嗎?
uj5u.com熱心網友回復:
的檔案git switch說明如下:
您可以使用
@{-N}語法來參考第 N 個最后一個分支/提交切換到使用 "git switch" 或 "git checkout" 操作。您還可以指定-哪個是 的同義詞@{-1}。這通常用于在兩個分支之間快速切換,或者錯誤地撤消分支切換。
因此,-相當于which 表示用or@{-1}選擇的最后一次提交。git switchgit checkout
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/466875.html
上一篇:合并/變基遠程跟蹤分支
