是否可以通过grgit插件为gradle提交一个文件?
我已经修改了version.properties文件,我只需要使用grgit插件将这个特定的文件提交回git。
但是当我回到git的时候,整个项目就会被提交回git分支。
我的代码
task pushToGit
{
def grgit = org.ajoberstar.grgit.Grgit.open(dir: '.')
grgit.commit(message: 'Committing Version Property Changes', all: true)
grgit.push(force: true)
}发布于 2016-08-06 01:11:34
all选项在grgit.commit上类似于git commit -a标志。它将提交对所有跟踪文件的更改。要只提交一个,您需要先将它添加到索引中,然后再提交。
task pushToGit
{
def grgit = org.ajoberstar.grgit.Grgit.open(dir: '.')
grgit.add(patterns: ['version.properties'])
grgit.commit(message: 'Committing Version Property Changes')
grgit.push(force: true) // not sure I would recommend this
}https://stackoverflow.com/questions/38793715
复制相似问题