Skip to content

Instantly share code, notes, and snippets.

@liorocks
Last active September 4, 2017 05:51
Show Gist options
  • Save liorocks/625a968f310b043ec2c48e2320b993e5 to your computer and use it in GitHub Desktop.
Save liorocks/625a968f310b043ec2c48e2320b993e5 to your computer and use it in GitHub Desktop.
GIT Tips & Tricks

Change Remote URL

$ git remote set-url origin <remote_repo>

Discard Unstaged/Untracked Changes

$ git checkout -- .
$ git reset --hard

Clone Specific Branch

$ git clone -b <branch> <remote_repo>

Switch/Toggle Between Last 2 Branches

$ git checkout -

Remove Cached Files

$ git rm --cached [dir|file|pattern] -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment