1
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 5 years have passed since last update.

Gitについて勉強する。 最終弾 (スタッシュで作業を退避してみよう 編)

Posted at

Gitについて勉強する。第九弾 (スタッシュで作業を退避してみよう 編)

スタッシュとは

現在行っている作業を一次避難させることができます。

コマンド

  • git stash
  • git stash save

現在の作業内容をスタッシュ領域に一次避難できます。
これをすると、git statusコマンドを行っても、ファイルを編集してない扱いになります。

スタッシュの一覧を表示する

  • git stash list

スタッシュの作業を復元する

最新の作業を復元する

  • git stash apply

ステージの内容も復元する

  • git stash apply --index

特定の作業を復元する

  • git stash apply "スタッシュ名"
    例:git stash apply stash@{0}

避難した作業を削除する

最新の作業を削除する

  • git stash drop

特定の作業を削除する

  • git stash drop "スタッシュ名"
    例:git stash drop stash@{0}

全ての作業を削除する

  • git stash clear
1
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
1
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?