Git中的文件级别跟踪(同一目录中的多个分支的文件) [英] File Level Tracking In Git (Files from multiple branches in same directory)

查看:177
本文介绍了Git中的文件级别跟踪(同一目录中的多个分支的文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有任何脚本可以记住在某个目录中的文件分支/提交,以便可以同时在同一目录中的branch2上的branch1和file2上的file1上工作,并正确地提交它们。如果不是我自己实现的话。



我的计划是为各种分支机构收回隐藏的结帐目录,并通过链接到这些文件填充明显的结帐,以便提交简单地承担各自隐藏的分支,但建议不胜感激因此,可以做一些类似

  mgit checkout branch1 filename / filegroup 
mgit add filename(自动为正确的分支/ repo)
mgit commit(自动为正确的分支/ repo)

任何人告诉我这是一个坏主意或不正确的使用版本控制考虑应用程序:



所以经常在TeX中写学术文档时,最终会出现您希望保留的松散相关的文件在版本控制。问题是这些文件是相关的,可以从git提供的历史/合并信息中受益,但通常需要独立选择不同版本的文件。最常见的是,您只需要在一些纸张的variant1上工作,同时也可以使用另一种纸张的variant2,但是您也可以使用TeX组合多个文件的情况,因此可以将您选择的变体放在同一个文件夹中。

简而言之,你有一堆不同的名称,通常是彼此相互衍生的(论文成为纸)的独特文件,受益于一个单独的回购,但它是笨重的有一打不同的签出工作,在每个文件的任何版本当前需要注意。

解决方案

不,我不认为这是由git本机支持的。

可能是本地挂钩像预先提交一个钩子可能会尝试在允许之前检查和检出正确的分支承诺继续。


Is there any script that lets one remember branch/commit seperatly for files in some directory so that one can simultaneously work on file1 on branch1 and file2 on branch2 in the same directory and have them commit appropriately. If not I'll implement it myself.

My plan is to have hidden checkout directories for various branches/repos and populating the apparent checkout with links to these files so that commits simply committed their respective hidden branches but advice would be appreciated. Thus one could do something like

mgit checkout branch1 filename/filegroup
mgit add filename   (automatically to it's correct branch/repo)
mgit commit  (automatically to it's correct branch/repo)

Before anyone tells me this is a bad idea or incorrect use of version control consider the application:

So often when writing academic documents in TeX you end up with loosely related files that you wish to keep in version control. The problem is that these files are related and can benefit from the history/merging info git provides but often different versions of the files need to be selected independently. Most commonly you simply want to work on variant1 of some paper while also working of variant2 of another but you also have situations where TeX combines several files so it's important to be able to put your choice of variants in the same folder.

In short you have a bunch of distinct files with distinct names which often derive from each other (thesis becomes paper), benefit from being in a single repo but it is unwieldy to have a dozen different checkouts to work on whatever versions of each file currently need attention.

解决方案

No, I don't think this is natively supported by git.
May be a local hook like a pre-commit one hook might try to check and checkout the right branch before allowing the commit to proceed.

这篇关于Git中的文件级别跟踪(同一目录中的多个分支的文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆