See exactly what you're about to commit
Plain git diff hides anything you've already staged. Add one flag to see what the commit will contain.
- Stage some changes with
git add. - Run
git diff --stagedto see what will be committed. - Run plain
git diffto see what's changed but not staged yet. - Run
git diff HEADto see both together.
Tip: --cached does exactly the same thing as --staged; you'll see both in other people's notes.
Try it now: In any repo, edit a file,
git add it, and compare git diff (empty) with git diff --staged.Next crumbs
- 💻 Terminal & gitStage only part of a file with git add -pFixed a bug and tidied something unrelated in the same file? Commit them separately, hunk by hunk.
- 💻 Terminal & gitSee your branches as a graphOne log command turns a wall of commit text into a readable branch map.
- 💻 Terminal & gitJump back with cd -Toggle between your last two directories, like Alt+Tab for folders.