I’m about to set up and automated build environment for a client. I want to push the Git repository to the client’s build server, but without complete Git history.
I’m thinking about an approach with git checkout --orphan ci, but it’s unclear to me how to work on a daily basis with a branch setup like this.
Maybe something like this (?):
- New commits will be created on the
master. - A feature is finished after several commits.
- The
cibranch is then rebased/merged (fast-forwarded) on themaster. cibranch is checked out.- The recent commits (which are not pushed to any server yet) are squashed to hide unnecessary history from the client.
- The
cibranch gets pushed to the build server. - …
Is that a valid approach and/or does an easier way exists?
One simple way of managing this could be:
master(or use any other feature branching model).Every time you finish a feature and want to push it to the CI system you:
git checkout cigit merge --squash masterThis will bring all of the changes inmasterto yourcibranch.git commitYou will have a pre-populated commit message with all of the squashed commit messages. You can then edit this message to reflect all of the changes in the feature.git push origin ciTo send your changes to the CI system.There are many branching models out there, but this should be simple enough and give you what you want.
I hope this helps.