0 votes
1 view
in DevOps and Agile by (20k points)

I've noticed that while working on one or two tickets, if I step away, I'm not sure what I worked on, what changed, etcetera.

Is there a way to see the changes made for a given file before git add and then git commit?

1 Answer

0 votes
by (28.4k points)

In case you want to view the differences between index and working tree use the following command:  

$ git diff [filename]

Alright, this command will show the changes you haven't staged to commit

In case you want to view the differences between current commit and index use the following command: 

$ git diff --cached [filename]

This command will display whatever you're about to commit

In order to view the differences between current commit and working tree use the following command

$ git diff HEAD [filename]

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...