我正在遵循这里描述的工作流程,因为我发现许多参考资料都将此页面视为良好的工作流程。如文章所述,“特性”分支在开发人员之间共享,但不会进入中央代码库。
假设开发人员“A”使用
我所做的:
1. 开发人员“B”将开发人员A的机器添加为远程主机 2. 开发人员“B”运行
步骤3目前无法工作。我收到了一条消息:
``` remote: error: By default, updating the current branch in a non-bare repository is denied, because it will make the index and work tree inconsistent with what you pushed, and will require 'git reset --hard' to match the work tree to HEAD. remote: error: You can set 'receive.denyCurrentBranch' configuration variable to 'ignore' or 'warn' in the remote repository to allow pushing into its current branch; however, this is not recommended unless you arranged to update its work tree to match what you pushed in some other way. remote: error: To squelch this message and still keep the default behaviour, set receive.denyCurrentBranch' configuration variable to 'refuse'. ```
我已经设置了
我的两个问题:
1. 共享功能分支的正确方法是什么? 2. 如何将开发人员B存储库中的更改推回开发人员A的原始存储库?
假设开发人员“A”使用
git checkout -b newfeature develop
开始一个新的功能分支。现在假设开发人员“B”也需要在此功能上工作。这是我的问题。我所做的:
1. 开发人员“B”将开发人员A的机器添加为远程主机 2. 开发人员“B”运行
git branch remoteA/newfeature
3. 开发人员“B”在此分支上工作,提交他的工作并将更改推送回remoteA步骤3目前无法工作。我收到了一条消息:
``` remote: error: By default, updating the current branch in a non-bare repository is denied, because it will make the index and work tree inconsistent with what you pushed, and will require 'git reset --hard' to match the work tree to HEAD. remote: error: You can set 'receive.denyCurrentBranch' configuration variable to 'ignore' or 'warn' in the remote repository to allow pushing into its current branch; however, this is not recommended unless you arranged to update its work tree to match what you pushed in some other way. remote: error: To squelch this message and still keep the default behaviour, set receive.denyCurrentBranch' configuration variable to 'refuse'. ```
我已经设置了
sharedRepository = true
,但没有帮助。我的两个问题:
1. 共享功能分支的正确方法是什么? 2. 如何将开发人员B存储库中的更改推回开发人员A的原始存储库?