This is a page of memos about how to do various tasks with the Git version control system. Disclaimer: I am not a git expert. Please exercise caution when you use the advice given here. If you have any comments, email me at the address at the bottom of the page.
To run a script before each commit, add a script with the
pre-commit to the directory
git pull edit files with editor to fix problems git add git commit
See Git: You are in the middle of a conflicted merge.
To clone all the files in
git clone dir1 dir2
To compare the last commit and the one before that,
git diff HEAD^ HEAD
To show a file at a particular revision,
git show 5ca5d4b7028824cec4dc536ea51a9533627e6805:filewhere the number here is the reference from the commitment. You can get the numbers using
This restores files you have deleted using
git ls-files -d | xargs git checkout --
See Git saved my day - restore accidentally deleted files using Git version control and a Linux mailing list.
git diff --cached
See Git by Example - SysMonBlog.