I have the following bash script:
git merge --squash -Xtheirs dev -m "squashing" &&
(./test/testsrc/shell/node-c.sh && echo "compiled successfully") || (git reset --hard; exit 1)
I have two questions:
- If the merge fails, do I need to do a git reset to go back to the state before the merge started?
- Assuming the answer to 1 is "yes", is the above script correct, such that if the node-c.sh script exits with a non-zero code, that git reset --hard will be called and will absolutely exit with code = 1?
I am thinking that when running git merge, the index will always be updated no matter what, so that git reset --hard is always the right thing to do.
As an aside, I am seeing what appear to be some bad Git bug, where the merge doesn't work and produces .js files that get mangled, and often times cannot even by compiled with "$ node -c". Not sure if anyone has seen this before, but I have filed a bug report with Git.