Skip to content

Instantly share code, notes, and snippets.

@carlin-q-scott
Created June 8, 2017 18:18
Show Gist options
  • Save carlin-q-scott/b901f2c521499a282c0ab85ca0adce01 to your computer and use it in GitHub Desktop.
Save carlin-q-scott/b901f2c521499a282c0ab85ca0adce01 to your computer and use it in GitHub Desktop.
git bash scripts
# Problem: Build servers check out tags to build them but we need to deploy our code based on the branch the code came from.
# Solution: Get branches containing the tag, figure out which one has the tagged commit as its head
$ git branch --contains tags/some-tag
* (HEAD detached at some-tag)
demo/carlin
demo/steve
$ git diff --shortstat demo/steve some-tag
4 files changed, 9 insertions(+), 20 deletions(-)
$ git diff --shortstat demo/carlin some-tag
# demo/carlin matches some-tag so that must be the branch we built from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment