Git will track changes to files and directories, including any changes to permissions done via chmod. In most development environments I tend to have a different set of permissions to those on the live site so I am usually not interested in tracking permissions changes. To prevent git from looking at the difference between the permissions of a file you need to set the core.filemode configuration option to false.
If you have changed or updated a git repository and want to throw away your changes then a good way of forcing the lastest changes to run a combination of two commands. The first command is git fetch --all, which tells git to download the latest updates from the remote without trying to merge or rebase anything. This is followed by git reset --hard origin/master where git resets the master branch (assuming you were on the master branch) to become the version of the master branch you just fetched. Here is the two commands in full:
Use the following command to find out how many commits there have been in a git repository. Not really useful in itself, but an interesting figure to see how active a project has been over it's lifetime.
git log --oneline --all | wc -l
The following git log flags are in use here:
--oneline - Removes some of the information from the log entries and displays each on a single line.
--all - Shows all commits across all branches.