问题描述
我要为客户端设置和自动构建环境。我想将Git存储库推送到客户端的构建服务器,但没有完整的Git历史。
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.
我正在考虑使用 git checkout - orphan ci
,但是我不知道如何使用这样的分支设置每天工作。
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.
也许这样(?):
- 将在
master
上创建新提交。 -
ci
分支会被重新组合/合并快速转发)master
。 -
ci
- 最近的提交(尚未推送到任何服务器)已被压缩,以隐藏来自客户端的不必要的历史记录。
-
ci
分支被推送到构建服务器。 - ...
- New commits will be created on the
master
. - A feature is finished after several commits.
- The
ci
branch is then rebased/merged (fast-forwarded) on themaster
. ci
branch is checked out.- The recent commits (which are not pushed to any server yet) are squashed to hide unnecessary history from the client.
- The
ci
branch gets pushed to the build server. - ...
这是一个有效的方法和/或有更简单的方法吗?
Is that a valid approach and/or does an easier way exists?
推荐答案
这可以是:
- 在
master
上正常工作(或使用任何其他特征分支
- Work normally on
master
(or use any other feature branching model). Every time you finish a feature and want to push it to the CI system you:
- $
有很多分支模型,足够简单,给你你想要的。
There are many branching models out there, but this should be simple enough and give you what you want.
我希望这有助。
这篇关于使用分支进行部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!