Skip to content

Instantly share code, notes, and snippets.

@schneems
Created March 26, 2012 22:06
Show Gist options
  • Save schneems/2210123 to your computer and use it in GitHub Desktop.
Save schneems/2210123 to your computer and use it in GitHub Desktop.
Remove File from Git Branch
# If you just want to remove a file called '/test/unit/user_test.rb' from your current branch it would look like this:
# Be wary not to use the --all option if you only want to act on the current branch
$ git checkout master
$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch test/unit/user_test.rb' --prune-empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment