Git Reference ยท Inspecting History
git whatchanged command
Reference for git whatchanged: a historical command that shows commits with raw diff output. Learn why it is deprecated and which git log options replace it.
git whatchanged shows commit logs together with the raw diff of each commit: one line per changed file with modes, object IDs and a status letter. It is the ancestor of today's git log, kept for old scripts and habits.
Git treats it as a deprecated command. Since Git 2.51 it refuses to run unless you pass --i-still-use-this, and the manual recommends git log --raw --no-merges instead, which produces the same kind of output. Use git log in anything new.
git whatchanged --i-still-use-this [<log-options>] [<revision-range>] [-- <path>...] git log --raw --no-merges [<revision-range>] [-- <path>...]
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Syntax
The raw format printed per file is a colon, the old mode, the new mode, the old object ID, the new object ID, a status letter, a tab and the path. For example :100644 100644 <old> <new> M<TAB>a.txt. Status letters: A added, M modified, D deleted, R renamed, C copied, T type changed.
| Option | Description |
|---|---|
--i-still-use-this |
Required by recent Git versions to acknowledge that the command is deprecated. |
-p |
Add the patch, like git log -p. |
--no-merges |
The old default: whatchanged omitted merge commits. git log --raw shows them unless you add this. |
--name-only, --name-status |
Shorter listings (these are git log options). |
-n <number>, <range>, -- <path> |
Limit commits like git log. |
Usage notes
- Differences from
git log --raw:whatchangedhid merge commits and always printed raw diffs;git logincludes merge commits (which print no diff by default) and prints no raw output unless you ask for it. - The command takes all
git logoptions because it is implemented asgit logwith defaults changed. - Old scripts that call
git whatchangedshould be changed togit log --raw --no-mergesso they keep working when the command is removed. - The raw format is also what plumbing commands such as git diff-tree and git diff-index print, so it is stable and easy to parse. Add
-zto separate fields with NUL bytes for file names with spaces.
Related
- git log, git diff, git diff-tree, git show
- Tutorial: Log and show