Skip to content

Instantly share code, notes, and snippets.

@rondy
Last active August 29, 2015 14:07
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 rondy/9e9067c1e7888b658523 to your computer and use it in GitHub Desktop.
Save rondy/9e9067c1e7888b658523 to your computer and use it in GitHub Desktop.
gpfb() {
git add . && git commit --amend -C HEAD && git push -f
}
# Public: Go to a git branch from a given partial name.
#
# $1 - The branch partial name.
#
# Examples
#
# $ gtb wip
# # Switched to branch 'rs-wip-feature-branch'
gtb() {
local remove_leading_whitespace="s/^ *//"
git br | grep $1 | head -1 | sed remove_leading_whitespace | xargs git checkout
}
# Public: Publish the current branch to a remote.
#
# Examples
#
# $ gpb
# # Counting objects: 185, done.
# # Delta compression using up to 2 threads.
# # ...
gpb() {
local remove_current_branch_indicator="s/^\*//"
local remove_leading_whitespace="s/^ *//"
git br | grep '\*' | sed remove_current_branch_indicator | sed remove_leading_whitespace | xargs git push -u origin
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment