问题描述
给定一个示例项目结构如下:$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $' files.htmls
other-stuff-to-keep.js
server.py
other.py
我想要做的是:
- 为主设计师创建新分支
- 删除设计器不需要的文件(服务器代码,例如* .py)
- 赋予设计器访问权限魔术发生 >
- 将分支合并回主服务器忽略服务器代码的删除,即我只想在完成清理(步骤#2)之后得到新代码的合并,即<$尽管在分支中删除了
server.py
,但在分支合并时不应删除主服务器中的c $ c> server.py 文件。 / li>
我知道我可以选择提交,但是我想知道是否有另一个git-ish方式来执行此操作
Git不是设计编辑你想要做的事情。如果您想阻止访问部分代码库,请查看使用子模块。
/ Git-Tools-Submodulesrel =nofollow> http://git-scm.com/book/en/Git-Tools-Submodules你的工作流程会导致过度复杂化,特别是当我想象会有其他人在处理你从设计器中删除的文件。
你也不能删除这些文件,并通过 git diff --name-only< branch>来检查合并中无关文件的更改。主
。特别是如果这些其他文件对于设计人员测试他们正在做的工作是必需的。
Given an example project structure like:
/project
/ui
front-endy-files.htmls
other-stuff-to-keep.js
server.py
other.py
What I would like to do is:
- create new branch for designer from master
- delete files not needed by designer (server code e.g. *.py)
- give designer access... magic happens
- merge branch back into master ignoring the deletion of the server code i.e. I only want to get the merge of new code after I've done the "clean up" (step #2) i.e. the
server.py
file in master should not be deleted on merge of the branch even thoughserver.py
was deleted in branch.
I know I could cherry-pick the commits but I'm wondering if there's another git-ish way of doing this
Git is not designed for what you are looking to do. If you want to prevent access to portions of your codebase look into using a submodule.
http://git-scm.com/book/en/Git-Tools-Submodules
Your workflow would result in over complications, especially as I imagine that there will be other people working on the files that you are deleting from the designer.
You could also not delete the files and examine the merge for changes to unrelated files via git diff --name-only <branch> master
. Particularly if those other files are necessary for the designer to test the work that they are doing.
这篇关于如何忽略git分支中用于合并目的的文件删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!