Reading previous post you learned about how to start work in git, how to check changes which you made since last commit and how to send your changes to external repo. Today next part of the adventure with git. In few words - part two of basics of git.
Ok, you have some repository, e.g. your code has been changed by other people. You get newest changes and want to know something about it. How you can do it the easiest way?
This command return basic informations about your code since it "birth". Will be returned commit number, author, date and change description (commit description) from the newest.
If you add
-p option you show changes diff additional. It is similar to
diff command, but not for local but all changes. It is possible to limit display changes by using digit like the next option, e.g.
git log -p -1
It return last change in every commit
If you want to display stats of changes, like number of changes lines or files, you should use follow command
git log --stat
In documentation you found other option for this command. There are not used very often, so I don't mention about them.
Now something espacially for forgetful! I think that you often forget add to commit somethning. Don't create new commit. Add this changes to previous
git commit --amend
That's all. You have to remember, that if you push this commit to repo earlier now you have to use
--force option to rewrite it on repo.
In your project can find files which you changed but won't send it to repo. This files are unstaged. If you want remove changes from this files use tip from git.
git checkout --file_name
You have to remember that this command can't be undone and you lost all changes in this file.