获取当前的 Git 分支并“重置”分支其内容交给Master
在工作中,每个开发人员都有自己的开发分支,即我们工作的开发分支。分支=员工的dev_name_of_employee。 IE。 dev_jon
dev_jon 有一个新功能,其中包含超过 100 个提交,尚未准备好进行测试或部署,因此我创建了另一个分支来将该新功能放入名为 staging_jon 的位置(可以将其称为 Holding_jon,无论如何)。
现在我需要开始另一个功能并让 dev_jon 包含 master 的内容。有点回归大师的感觉。
如何在不删除 dev_jon 及其远程分支,然后从 master 重新创建它的情况下执行此操作?我无法上演所有这些更改,因为它们已经被推动了。
或者是否有更好的方法让每个员工在开发过程中在他/她自己的一致分支上工作?
At work, each developer has his own development branch we work off of, ie. branch = dev_name_of_employee. IE. dev_jon
dev_jon has a new feature with over 100 commits in it that is not ready to be tested or deployed, so I created another branch to put that new feature in called staging_jon (could have called it holding_jon, whatever).
Now I need to start on another feature and have dev_jon contain the contents of master. Kind of a revert back to master thing.
How can I do this without deleting dev_jon and its remote branch, then recreating it from master? I cant stage all these changes because they are already pushed.
Or is there just a better way to have each employee work on his/her own consistant branch during development?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 dev_jon 中,您可以执行以下操作:
可能不直接适用/相关,但您可以查看 GitHub 流程: http://scottchacon.com/2011/08/31/github-flow.html
In dev_jon, you can do:
May not be directly applicable / relevant, but you can look at GitHub flow: http://scottchacon.com/2011/08/31/github-flow.html
我认为您当前的模型并不是非常理想,开发人员应该能够同时开发多个功能,因此每个开发人员只有一个分支并不是最灵活的。无论如何,在你的情况下,假设 dev_jon 正在跟踪 origin/master,我会做什么:
这也假设你当前位于 dev_jon 分支上。
希望有帮助,
I don't think your current model is really ideal, a developer should be able to develop on multiple features at the same time therefore only one branch per developer is not the most flexible. Anyway in your situation here what I would do assuming that dev_jon is tracking origin/master:
This is also assuming you are currently on dev_jon branch.
Hope it helps,
您可以执行硬重置以使您的
dev-jon
分支与 master 分支相同,但是当您发布新作品时必须小心。远程分支origin\dev_jon
将是您的旧功能,当您推送时,您会收到如下警告:请考虑按照 larsmans 的建议创建功能分支。
You can perform a hard reset to get your
dev-jon
branch to be the same as master, but you'll have to be careful when you come to publish your new work. The remote branchorigin\dev_jon
will be your old feature and when you come to push you'll get a warning like the followingConsider creating a feature branch as suggested by larsmans.