In this short article, we would like to show how to print changes for the indicated file only in Git.
git diff path/to/changed/file
git statusto see changed paths under command line.
Let's suppose we have updated our project getting the following report using
On branch master Your branch is up to date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: common/config.sh modified: run-application.sh modified: ui/package-lock.json Untracked files: (use "git add <file>..." to include in what will be committed) libs/ no changes added to commit (use "git add" and/or "git commit -a")
Let's suppose we want to check changes in
$ git diff ui/package-lock.json
As we can see there are only some changes related to dependencies update.