Skip to content

Instantly share code, notes, and snippets.

@claruspeter
Created August 13, 2021 03:43
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 claruspeter/ab90f1503bb30312f9090a707b187a2a to your computer and use it in GitHub Desktop.
Save claruspeter/ab90f1503bb30312f9090a707b187a2a to your computer and use it in GitHub Desktop.
[alias]
# USAGE: in a repo folder in the terminal type `git <alias>`. e.g. `git branchname`
# The simple name of the current branch
branchname = "!git rev-parse --abbrev-ref HEAD"
# Publish the current branch to DEV
pubd = "!git push origin $(git branchname):dev --force"
# Publish the current branch to TEST
pubt = "!git push origin $(git branchname):test --force"
# Run this in DEV/TEST to see which branch was force pushed to it and who did it
pubsource = "!git for-each-ref --points-at $(git rev-parse HEAD) --format '%(refname:short)~~%(committername)~~%(committerdate:iso)' | grep 'origin/' | grep -v 'dev~\\|test~\\|prod~'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment