Posts

Showing posts from July, 2014

GIT

Git Useful If you are here, you've seen the trailing whitespace errors shown by Git when committing changes. These errors can indeed cause problems. Not only when e-mailing patches but also when working with weird glue tools such as git-p4 which relies on patches to sync changes to Perforce. One way to deal with these is ignoring them. While that works, it does only until whitespace introduces unintended change in a patch and things explode. To avoid that it is better to keep your files clean from trailing whitespace which can be easily achieved by using a pre-commit hook in Git. This hook is a script which is ran before each commit to do something useful. In this case to clean trailing whitespace. To install such a hook you can do the following:    In a terminal of some sort, go to your working git repository ($GIT_DIR):     cd $GIT_DIR     Now open a new file for writing:     cat > .git/hooks/pre-commit     Paste the following code in the terminal:     #!/bin/sh     if git