Let’s say you did some changes to several files, but you don’t remember which ones. How do you proceed?
A git status
will be enough in most cases, but it just shows which files changed – what if you want to see the actual changes you made?
The answer is:
$ git diff
It shows every line of code you changed and that you haven’t committed yet. Useful, isn’t it?
If you have already committed some code, but not pushed yet, don’t be afraid: you’re still in time to check if everything is good, and a git log
will come handy:
$ git log -p
You probably already know the power of git log
, but -p
makes it even more powerful, because it will also show a patch of what changed in each commit.