Removing deleted files from the Git index
When working with Git it can be cumbersome to have to remove files from the index (marking them deleted rahter missing) if you did not delete them using git-rm. Here’s bash one-liner for that:
git rm $(git ls-files -d)
I’ve got that aliased to grd (Git Remove Deleted).
Using git stash branch
When using Git I sometimes end up with a bunch of changes that would really be better off in a feature branch. Here’s a quick way to take those changes in your working copy and start a feature branch quickly:
git stash
git stash branch my_branch_title
From the docs on git stash branch:
Creates and checks out a new branch named starting from the commit at which the was originally created, applies the changes recorded in to the new working tree and index, then drops the if that completes successfully. When no is given, applies the latest one.
Awesome.