LoginSignup
67
59

More than 5 years have passed since last update.

【Git】stashした内容をdiff表示する

Posted at

git stashの基本

stashコマンドは変更を一時的にしまっておけるコマンド。

$ git stash         # 変更をスタックにプッシュする
$ git stash list    # スタックにある変更を一覧表示する
$ git stash drop    # スタックの一番上にある変更を削除する
$ git stash pop     # スタックから変更を一つポップする

スタックにある変更差分を確認したい時

git stash liststash@{N}の番号を確認する。

$ git stash list
stash@{0}: WIP on branch_name: commit_id2 commit_comment2
stash@{1}: WIP on branch_name: commit_id1 commit_comment1

中身を見たい番号を指定して、以下のコマンドでHEADとの差分を確認できる。

$ git diff stash@{0}

ファイル指定もできる。

$ git diff stash@{0} hoge.txt
67
59
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
67
59