【发布时间】:2019-08-30 17:55:29
【问题描述】:
我有两个 git repos:
- 为开发者和他们的日常提交提供一个私有的
- 还有一个用于公开发布的公开版本。
每当我想发布代码时,我都想将开发者仓库的快照推送到公共仓库。由于开发者 repo 可能包含一些不适合公开的提交消息,我想用新的提交消息推送到公共 repo。
我的想法是(假设我在 dev repo 的主分支中):
// create remote
git remote add p_repo git://some_repo
// create orphaned branch to get rid of commit history
git checkout --orphan pub_sync
// commit
git commit -m "release info"
// push local master to remote master
git push p_repo pub_sync:master
当公共存储库为空时,这是第一次工作。但是对于第二次公开推送,我得到了一个快进错误。 与此同时,没有其他对公共回购的承诺!
我认为问题是,git 不知道孤立分支与公共 master 相关。
但是我该如何解决呢?
【问题讨论】:
标签: git git-rebase git-push git-remote