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?
2022-09-13
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?
You're looking for
git diff --staged
Depending on your exact situation, there are three useful ways to use git diff
:
git diff [filename]
--staged
does exactly the same thing, use what you like):git diff --cached [filename]
git diff HEAD [filename]
git diff
works recursively on directories, and if no paths are given, it shows all changes.