0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

一旦、他のブランチに移動したい時は git stash コマンドを使う

0
Posted at

作業ディレクトリから一時的に避難したい

現在の作業ブランチから、一旦他のブランチに移動したい!ってことありますよね。
そんな時に使えるのがgit stashというコマンド。

stash:隠し場所

gitには、stashという特別な空間があります。ブランチでの作業をコミットする前に一時的に保存できる領域です。
git stashというコマンドを入力すると、最後の作業内容(スタッシュ)は特別な空間に一時的に保存され、作業ディレクトリは一番最後のコミット時にリセットされる。
スタッシュには、名前が当てられる(stash@{n})

最初のスタッシュ (stash@{0})
2番目のスタッシュ(stash@{1})
3番目のスタッシュ(stash@{2})

よし、一旦他のブランチでの作業も終えたし、もう一度作業に取り掛かりたい!

そんな時はgit stash applyで復元することができる!

以上

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?