bash

Automatically Change Links from Absolute to Relative

In this example I'm showing one way to quickly convert all a href and img src paths from absolute to relative. It's quite a time saver, but I suggest commiting your latest changes before trying anything here! If you aren't using a version control system, make a backup somewhere... please!

Using Vimdiff with Git

The following examples show how to use vimdiff and git-show to view the differences between two versions of a file (that is in a git repository). Note that you must run these commands from the root of the git repository.

Vimdiff with the peaksea colorscheme

Automatically Stage All Deleted Files (Git)

Tab-completion is a really nice thing that we often take for granted. While working with Git I've found that it becomes inconvenient to stage (add for inclusion in the next commit) removed files using git rm path/to/my/file.php. Tab completion doesn't work on paths that no longer exist, so you have to manually type the path to the deleted item. The following snippet automatically stages ALL removed files.

git ls-files -d -z | xargs -0 git rm --cached --quiet

"755"-style Permissions with 'ls'

After a quick Google search for "ls permissions octal" I found a very handy alias to put in my .bashrc. Not only is it handy to see the OCTAL value of the permissions for each file/dir, it will undoubtedly help you more quickly recognize/interpret the normal ls -al output.