7
7

More than 5 years have passed since last update.

gitでさっきまでいたブランチに戻る

Posted at

git checkout -で切り替え前のブランチに戻るみたい。

$ git checkout AAA
Switched to branch 'AAA'
$ git checkout BBB
Switched to branch 'BBB'
$ git checkout -
Switched to branch 'AAA'

ディレクトリ移動もcd -で直前の場所に戻れるけど、同じ感じ?

ドキュメントにも書いてあった。

<branch>

As a special case, the "@{-N}" syntax for the N-th last branch/commit checks out branches (instead of detaching). You may also specify - which is synonymous with "@{-1}".

7
7
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7