Skip to content

Instantly share code, notes, and snippets.

@ghurlman
Created April 27, 2019 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghurlman/734d756ae27865d8e14b36d1af1e8a6a to your computer and use it in GitHub Desktop.
Save ghurlman/734d756ae27865d8e14b36d1af1e8a6a to your computer and use it in GitHub Desktop.
Nuke that repo from orbit with this simple command!
# Put this in your $PROFILE! Or load it in from there. Whatever.
# Usage:
# gitnuke [path]
#
# If no path defined, uses the current directory
function gitnuke($path)
{
if ($path -eq '')
{
$path = "."
}
$reply = Read-Host -Prompt "Nuke back to a clean HEAD? [y/n]"
if ($reply -match "[yY]" ) {
Push-Location $path
git clean -xdf
git reset HEAD --hard
Pop-Location
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment