Skip to content

Instantly share code, notes, and snippets.

@monkbroc
Created July 29, 2017 03:48
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 monkbroc/70a89763ab3ef7b38dd1f870596f75be to your computer and use it in GitHub Desktop.
Save monkbroc/70a89763ab3ef7b38dd1f870596f75be to your computer and use it in GitHub Desktop.
Useful git commands
#!/bin/bash
# Save as ~/bin/git-amend then chmod +x ~/bin/git-amend
# Usage: `git amend` to silently amend a previous commit
git commit --amend --no-edit $*
#!/bin/bash
# Save as ~/bin/git-fetch-pr then chmod +x ~/bin/git-fetch-pr
# Usage: `git fetch-pr 1` to check out a branch for a GitHub pull request
git fetch origin pull/$1/head:pr/$1 && git checkout pr/$1
#!/bin/bash
# Save as ~/bin/git-sunrise then chmod +x ~/bin/git-sunrise
# Usage: `git sunrise` to start a new repo!
set -xe
git init
git add .
git commit -m ':sunrise:'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment