Help us understand the problem. What is going on with this article?

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

More than 3 years have passed since last update.

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
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away