Git provides the way to track changes in repository.In this article I will tell you how you can track the changes of your repository before and after committing the changes.
git status : The git status command will help you to track the changes before committing. This command will let you see which of the files are changes from last commit, which files are staged, and which are the files are not tracked by the git. The git status command will give you all those files list which are in staged area and ready to commit.
$ git status
The above command will show you list of all staged, unstaged and untracked files.
git log : The git log command will show committed snapshot. The git log command is very useful when you want to show the history of the last committed.It gives you freedom to check project history, you can filter it and also can search for specific changes.
$ git log
The above command will show the entire history in a default formating view.You can use space to scroll and 'q' to exit.
$ git log -n <limit>
The above command will show the limited number of committed history using attribute . For example
$ git log -n 4
will show only last 4 commit history.
$ git log --oneline
The above command will show the history by compressing the messages in one line. This will show the messages in more ordered way.
$ git log --stat
The above command will show the committed history with all the files which are altered and the related number of lines which are added and deleted from each of them.
$ git log <since> <until>
The above command will show the committed history between the two committed versions.
Both of these parameters can be committed ID, branch name, HEAD or any other kind of revision reference.
$ git log <file>
The above command will only show the committed history which contains the particular file.This is the way to see the history of particular file.