Skip to content

Instantly share code, notes, and snippets.

@farrellit
Last active October 25, 2018 15:21
Embed
What would you like to do?
thoughts on git commands for automatic k8s branch deployments

Git commands for a slim deployment pipeline for github branches

get current branch

TODO: what happens if you're not on a branch?

git rev-parse --abbrev-ref HEAD

Get upstram of current branch

TODO: what if there isn't one?

git rev-parse --abbrev-ref --symbolic-full-name @{u}

check whether diff from upstream shows any differences

TODO: will this also show changes in upstream we don't have?

[[ "git diff HEAD@{u} | wc -c " -eq "0" ]]

check whether we're fully committed

[[ "`git status --porcelain | grep -v '^[?][?]' | wc -c `" -eq "0" ]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment