更新时间:2022-10-28 20:14:13
如何在Git中显示未提交的更改
您正在查找的命令是
How do I show uncommitted changes in Git?
I SFTW'ed, and those commands does not working.
teyan@TEYAN-THINK MINGW64 /d/nano/repos/PSTools/psservice (teyan/psservice) $ git status On branch teyan/psservice Your branch is up-to-date with 'origin/teyan/psservice'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: psservice.c modified: psservice.vcxproj.filters teyan@TEYAN-THINK MINGW64 /d/nano/repos/PSTools/psservice (teyan/psservice) $ git diff teyan@TEYAN-THINK MINGW64 /d/nano/repos/PSTools/psservice (teyan/psservice) $ git diff master fatal: ambiguous argument 'master': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]'
How to show uncommitted changes in Git
The command you are looking for is
git diff
.
git diff
- Show changes between commits, commit and working tree, etc
Here are some of the options it expose which you can use
git diff
(no parameters)
Print out differences between your working directory and the index.
git diff --cached
:
Print out differences between the index and HEAD (current commit).
git diff HEAD
:
Print out differences between your working directory and the HEAD.
git diff --name-only
Show only names of changed files.
git diff --name-status
Show only names and status of changed files.
git diff --color-words
Word by word diff instead of line by line.Here is a sample of the output for
git diff --color-words
: