Skip to content

Instantly share code, notes, and snippets.

@jsyzdek
Created September 9, 2023 15:16
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 jsyzdek/51f0cc93ff30e6625b556959a4a443b7 to your computer and use it in GitHub Desktop.
Save jsyzdek/51f0cc93ff30e6625b556959a4a443b7 to your computer and use it in GitHub Desktop.
GIT reset current branch and remove untracked files
# git clean is destructive, particularly if you have .env files
# and/or /vendor or /node_modules directories.
# Instead, use this to reset your current branch back before a pull or something.
#
# Personally, I keep this in my ~/.bashrc file so it's available on session boot.
alias gitr='git reset --hard && git ls-files --others --exclude-standard | xargs rm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment