Git - sjherrick/code-base GitHub Wiki

Git

Undo Changes

  • Discarding local changes (permanently) to a file:

git checkout -- <file>

  • Discard all local changes to all files permanently:

git reset --hard

Merge branch with master

  • Switch to master and merge
git checkout master
git merge new-branch

Delete branch

  • Local

git branch -d branch_name

  • Remote

git push <remote_name> --delete <branch_name>

Stash

  • Stash changes when you want to quickly switch branches
git stash
  • Retrieve most recent stash
git stash pop
  • List stashes and pick the specific one to pop
git stash list
git stash pop stash@{1}
⚠️ **GitHub.com Fallback** ⚠️