ローカルでのいろいろ差分確認(GitHub)
忘れたときのメモです。
add前
% git diff
add後commit前
% git diff --cached
commit後push前
開発ブランチをpushしたことがある場合
(origin/[開発ブランチ]がある場合)
# git log origin/[開発ブランチ]..[開発ブランチ]
まだ一度も開発ブランチをpushしたことがない場合
((origin/[開発ブランチ]がない場合)
# git log origin/main..[開発ブランチ]
最新のコミットのみの変更
# git diff HEAD^
add前とcommit前など
% git status
# commit前
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: foo.txt
# add前
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: baz.txt
# Git管理されていない、かつ .gitignore で管理除外対象にもされていないものの一覧
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore