Skip to content

Instantly share code, notes, and snippets.

@farrellit
Last active October 25, 2018 15:21
Show Gist options
  • Save farrellit/e4f1bfc75b1e4d9cfe82e1f113309c68 to your computer and use it in GitHub Desktop.
Save farrellit/e4f1bfc75b1e4d9cfe82e1f113309c68 to your computer and use it in GitHub Desktop.
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