Search code examples
gitgit-diff

How to see the changes happened in a file, resulted by uncommitted changes git?


Suppose I am in someBranch in git and I have made some changes to files file1 and file2 which are not committed yet.

Is there a way/git command to see(cat in linux) the lines I have changed of a given file(ex: file1) in terminal?


Solution

  • If you have just modified the file but not git add yet, git diff or git diff -- file1.

    If you have added it but not committed, git diff --cached or git diff --cached -- file1.