Last active
November 4, 2016 00:44
-
-
Save m-renaud/1b2926c91f36274e1ebb1023066c8f7c to your computer and use it in GitHub Desktop.
Git commands for building generated files on another branch and pulling them in temporarily for a build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Save the current branch. | |
previous_branch=`git rev-parse --abbrev-ref HEAD` | |
# Switch to generated code branch and pull in any changes from the working branch. | |
git checkout generated-code | |
git merge --no-edit $previous_branch | |
# <Build generated files> | |
# Run whatever code gen commands here you need to. | |
# Commit all generated files. | |
git add --all | |
git commit -m "Generated code" | |
# Switch to the working branch and merge in generated files, but don't commit them. | |
git checkout $previous_branch | |
git merge --no-commit --no-ff generated-code | |
# <Build binary> | |
# Run whatever build commands here you need to. | |
# Discard generated files pulled in by the merge. | |
git merge --abort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment