没有分支的分支
这似乎是一个奇怪的问题,但请耐心听我说。
我想(ab?)使用 git 来处理我正在处理的一个小项目,我想在其中对文件进行分支,但将分支文件保留在当前分支中的新名称下,维护历史记录(允许我将更改重新设置为原始版本)。我想这与 Subversion 类似,因为 Subversion 不知道分支,而只知道副本。
我想要兼作文档模板的文档(这些是纯文本文件,不用担心合并是很有可能的),并且为了将新文档建立在另一个文档的基础上,我只想对其进行分支。
这对于 Git 来说是可能的吗?如果不是(考虑到 Git 的结构,我实际上假设不是),是否有任何可以想到的替代方案?不过,我不想离开 Git,因为我使用它的次数更多,所以如果没有好的解决方案,我想我可以在它之上实现我自己的(轻量级)分支/rebase。
This might seem like a weird question, but bear with me.
I'd like to (ab?)use git for a little project I'm working on, where I'd like to branch a file, yet keep the branched file within the current branch under a new name, maintaining history (allowing me to rebase changes to the original). This is similar to Subversion I suppose, in that Subversion doesn't know branches, and just copies.
I'd like to have documents which doubles as document templates (these are plain text files, don't worry merging will be quite possible), and in order to base a new document on another document, I'd like to just branch it.
Is this at all possible with Git? If not (and I'm actually assuming it's not, given Git's structure), are there any conceivable alternatives? I don't want to move away from Git, though, as I use it for much more, so if there's no good solution, I guess I can live with implementing my own (lightweight) branch/rebase on top of it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
分支有什么问题吗?您可以非常轻松地维护“模板”分支并在它们之间移动更改的文档。
比如说:
What's so wrong with branching? You could pretty easily maintain a "templates" branch and move your changed documents between them.
Say, for example:
git 将为您检测文件的副本并正确跟踪它们的历史记录。
也许我不明白你在问什么?
git will detect copies of a file for you and track history correctly on them.
Maybe I'm not understanding what you are asking?
您可以想象在目录树中的不同位置安装相同的子模块,并安装不同的版本。文件名相同,但版本不同。不过,我不确定我是否愿意成为维护这些东西的人。
You could conceivably mount the same submodule at different places in the directory tree, with different versions mounted. The filename would bethe same, but with different versions. I'm not sure I'd like to be the one maintaining that stuff, though.