Skip to content

Instantly share code, notes, and snippets.

@sploiselle
Last active August 2, 2017 20:34
Show Gist options
  • Save sploiselle/63a05e33851f3eb634d985fd5e7167b3 to your computer and use it in GitHub Desktop.
Save sploiselle/63a05e33851f3eb634d985fd5e7167b3 to your computer and use it in GitHub Desktop.
Tips for Using Git
  • Open new branch:

    git checkout -b [branch_name] origin/master
    
  • "Undo" changes to file:

    git checkout /path/to/file
    
  • Untrack new file:

    git reset HEAD /path/to/file
    
  • View files in commit:

    git rev-parse HEAD | xargs -t -n1 git diff-tree --no-commit-id --name-only -r
    
  • Add changed files to last commit w/o changing commit message:

    git commit -a --amend --no-edit
    
  • Force update a branch:

    git push --force origin
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment