- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
情况
我们有一个 git 工作流程,其中所有发布版本都堆叠在 master
分支上,当提交准备好部署时,我们为其添加一个标签,然后使用 git archive
构建要部署的包。
我们使用一个 version.txt
文件,在 .gitattributes
中用 export-subst
选项标记,来跟踪哪个提交是用于构建给定的存档。
问题
如果我在 version.txt
中编写 $Format:%d$
,并导出一个标记的提交,我将得到类似 (HEAD, tag, master)
写入结果文件。
我怎样才能单独使用标签
?
[edit] 有一个 git 命令已经产生了:
git describe --tags HEAD
这将输出:
latest_tag #if HEAD is tagged
latest_tag-5-g03cc91b #if HEAD is not tagged,
#and the latest tag is 5 commits ago on commit g03cc91b
有什么方法可以用 version.txt
中的这个输出替换 slug 吗?
最佳答案
你可以使用 content filter driver这将在 git checkout 上自动执行您想要的确切更改。
(来自 Pro Git book 7.2 Customizing Git - Git Attributes)
您在 .gitattributes
file 中声明一个 smudge
脚本,它将替换一个特殊标记(你想用 git describe --tags HEAD
替换),而不触及其他要修改的标记通过 export-subst
在 git archive
上。
然后你调用git archive
,应该(未测试)替换其余部分。
关于git - 在 "export-subst"文件中添加标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19659976/
假设我与两个内图f和g有传递关系~。假设 f 和 g 处处一致且 f a ~ f b ~ f c那么有两种方式显示g a ~ g c:通过给定的等式将每个 f 转换为 g 然后应用及物性,或者应用传递
我有一个 Makefile,大致如下所示: FIGURES = A1_B1_C1.eps A2_B2_C2.eps A3_B3_C3.eps NUMBERS = 1 2 3 all : $(FIGUR
假设我与两个内图f和g有传递关系~。假设 f 和 g 处处一致且 f a ~ f b ~ f c那么有两种方式显示g a ~ g c:通过给定的等式将每个 f 转换为 g 然后应用及物性,或者应用传递
我刚刚编写了一个程序,在循环内调用 subst 以及许多其他函数,到目前为止,subst 函数调用占用的时间最多时间。下面是一段概念性的代码片段,其中包含了我编写的程序的精髓。 (loop
当我们附加可移动驱动器时,操作系统会为其分配驱动器号。另一种方法是使用 subst 命令将本地文件夹映射到任何驱动器。我正在编写资源管理器的 Hook ,我需要在其中区分这两个驱动器。我尝试使用 Ge
在Windows中使用subst命令创建虚拟驱动器有什么意义。我正在为我的原始源代码目录创建虚拟驱动器,然后使用虚拟驱动器进行编译、编辑等所有操作。 它的主要用途是什么?我们不能在我 checkout
我想在 for 中进行字符串替换使用命名捕获阻止。我希望得到数字 1,2,3 作为输出。但它是Nil第一次运行,然后 1 和 2 用于第二次和第三次运行。如何使用 .subst在循环构造中正确吗?我在
我正在公司开发一个内部搜索引擎,使用 Flask 和 sqlalchemy(sqlite) 用 python 编写。我目前的问题是我愿意。 A.) 查询描述字段的一定信息量B.) 最好在它之前 50
我已经通过 HKCR\Drive\shell\MapLocalDriveHere\command 中的注册表向我的上下文菜单添加了一个命令,这样当我右键单击一个驱动器时。我希望它给我右键单击的驱动器名
我有以下 powershell 2.0 脚本: function getFreeDrive { [char[]]$driveLetters = @([char]'E'..[char]'Z')
我在从 Windows 批处理文件调用 SUBST 时遇到问题。我想使用一批来创建虚拟驱动器映射,并使用第二批来卸载驱动器。但是卸载给出了错误信息: The system cannot find th
情况 我们有一个 git 工作流程,其中所有发布版本都堆叠在 master 分支上,当提交准备好部署时,我们为其添加一个标签,然后使用 git archive 构建要部署的包。 我们使用一个 vers
我参加了 CPP 语言类(class),我试图了解 makefile 中“subst”的用法(一般情况下)以及此 makefile 中的具体用法。 我试图用谷歌搜索“subst”的用法,但没有找到。
我需要将子字符串移动到时间戳字段中。但是如果我编译它,我会得到错误号 RNF7416 - EVAL 运算中表达式左右两侧的操作数类型不匹配。 代码: MONITOR; TSTPFIELD = %S
我想知道是否有一种通用的方法可以使用驱动器号(例如 X:\foo\bar.txt )将路径解析为其等效的 UNC 路径,这可能是以下之一: X:\foo\bar.txt如果 X:是真正的驱动器(即硬盘
我有以下列表: (1 (2)) 我想用 (2 (3)) 代替 (2) 以获得: (1 (2 (3))) subst 的使用没有返回想要的结果: (subst '(2 (3)) '(2) '(1 (2)
我在 Windows 上的开发环境包括子文件夹,即文件夹 c:\MyBuild 可以替换为驱动器号,例如 t: 在 Ubuntu 子系统终端中,我可以将文件夹绑定(bind)到挂载,如下所示 sudo
我在 Windows 的 subst 文件夹中运行 python 脚本: c:\MyFolder\Tmp\Code\subst O: . O:\script.py script.py 正在运行 get
我正在尝试在我的 Windows 设置上映射一个虚拟驱动器,我使用的工具之一不喜欢文件名中的空格。 在命令行上,我会执行以下操作 subst l: "c:\Program Files\Complier
使用 创建的文件夹SUBST cmd 不工作 IIS 6 .在 IIS 7 (使用 Windows 7)浏览时未列出虚拟驱动器,以便为虚拟目录设置物理路径。 任何人都可以告诉我如何解决这个问题? 除了
我是一名优秀的程序员,十分优秀!