Skip to content

Instantly share code, notes, and snippets.

@mgurov
Last active December 3, 2021 14:34
Show Gist options
  • Save mgurov/47e3adf484d007fcf9f3b86eef52d07e to your computer and use it in GitHub Desktop.
Save mgurov/47e3adf484d007fcf9f3b86eef52d07e to your computer and use it in GitHub Desktop.
gitline - a shell alias to derive a git branch name from the last commit subject and push to origin
alias gitline='git log -n 1 --format=''%s'' | xargs echo refs/heads/mykola | tr " :" _ | xargs git check-ref-format --normalize | xargs -I {} git push origin HEAD:{} || echo something went wrong'
gitline() {
git log -n 1 --format='%s' | tr " :.'" _ | xargs -I {} echo refs/heads/mykola_{} | xargs git check-ref-format --normalize | xargs -I {} git push origin HEAD:{} || echo something went wrong
}
@mgurov
Copy link
Author

mgurov commented May 5, 2021

Or rather

gitline() {
  git log -n 1 --format='%s' | tr " :.'" _ | xargs -I {} echo refs/heads/mykola_{}  | xargs git check-ref-format --normalize | xargs -I {} git push origin HEAD:{} || echo something went wrong
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment