Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

How do I show uncommitted changes in Git?

I SFTW'ed, and those commands do not work.

Bhamra@Bhamra-THINK MINGW64 /d/nano/repos/PSTools/psservice (bhamra/psservice)

$ git status

On branch bhamra/psservice

Your branch is up-to-date with 'origin/bhamra/psservice'.

Changes to be committed:

  (use "git reset HEAD <file>..." to unstage)

        modified:   psservice.c

        modified:   psservice.vcxproj.filters

bhamra@bhamra-THINK MINGW64 /d/nano/repos/PSTools/psservice (bhamra/psservice)

$ git diff

bhamra@BHAMRA-THINK MINGW64 /d/nano/repos/PSTools/psservice (bhamra/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>...]'

1 Answer

+1 vote
by (62.9k points)

The command you're searching for is git diff.

git diff - Shows changes between different commits like their commit ID, commit and working tree, etc

Here are some of the choices it exposes that you can use

git diff (no parameters)

Print out differences between your working directory and the index.

git diff --cached:

Print out variations 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 rather than line by line.

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...