Skip to content

Instantly share code, notes, and snippets.

@probablycorey
Created January 9, 2015 17:34
Show Gist options
  • Save probablycorey/9448f95d80b7bcafc5b6 to your computer and use it in GitHub Desktop.
Save probablycorey/9448f95d80b7bcafc5b6 to your computer and use it in GitHub Desktop.
How do I unstage a staged deletion?
# Assume my-file.txt has been commited previously
repo = Rugged::Repository.discover(some_dir)
File.delete("my-file.txt")
# This will stage the file deletion
repo.index.remove("my-file.txt") # This doesn't work
repo.index.write
# How do I "unstage" this deletion?
repo.index.add("my-file.txt") # This doesn't work... what will?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment