I have a feature
branch and a testing
branch (for initial regression). I would like to have a working copy available for my testing
branch for the testing environment. However, I need to compress some of the source code (not into binary, just optimize) via a script. I can enact this script via a post-receive Git hook.
I'm trying to design my bash script (for CI) so that it's fairly robust and want to avoid automation causing Git conflicts. I'm thinking of having a main repository (origin
) and a testing environment repository (ci_test
) simply to allow CI to commit.
I'm thinking about pushing to ci_test/testing
when promoting source. CI should compress, add, commit, fetch from origin/testing
, merge if necessary (taking theirs-full iff conflicts), then push to origin/testing
.
The problem to my model above is that Git complains when I attempt to push to ci_test/testing
because it has a working copy (makes sense, because they may not be synced). Is there a proper (automated) way to use Continuous Integration scripts with Git so that they're still tracked?
The problem to my model above is that Git complains when I attempt to push to
ci_test/testing
because it has a working copy (makes sense, because they may not be synced).
You can either:
make sure your ci_test
is a bare repo, with a post-receive
hook which would:
testing
or, if you are the only one pushing to that ci_testing
remote repo, configure the remote Git to accept pushes to a non-bare repo.
This is possible since Git 2.3+ with:
git config receive.denyCurrentBranch updateInstead
And with Git 2.4+, you can setup the remote ci_testing
with a "push-to-checkout
" hook, which can be installed on the server to customize exactly what happens when a user pushes to the checked-out branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With