作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用grgit添加git标记,提交并将文件推送到远程分支。这是我想做的事情:
//Task to push updated build.info to remote branch
task pushToOrigin {
doLast {
def grgit = Grgit.open(dir: ".")
grgit.add(patterns: ['web/build.info'])
grgit.tag.add(
name: "Tag3",
message: "Release of 3-${grgit.head()}",
force: true
)
grgit.commit(message: "Updating build.info")
//push to remote
grgit.push(remote:"${branch}", tags: true)
//grgit.push(remote:"${branch}")
//cleanup
grgit.close()
}
println "Completed task: pushToOrigin"
}
grgit.push(remote:"${branch}", tags: true)
添加了标签并将标签推送到远程,但没有推送我暂存的文件更改。
grgit.push(remote:"${branch}")
会推送暂存文件的更改,但不会推送标签。
最佳答案
我找到了解决上述问题的方法。这是我所做的:
task pushToOrigin {
doLast {
def grgit = Grgit.open(dir: ".")
grgit.add(patterns: ['web/build.info'])
grgit.commit(message: "Updating build.info")
//Push to remote
grgit.push(remote:"${branch}")
//Tag
tagName = "tag1"
grgit.tag.add(
name: tagName,
message: "Release of ${tagName}"
)
//Push
grgit.push(remote:"${branch}", refsOrSpecs: [tagName])
//cleanup
grgit.close()
}
}
关于git - grgit:在build.gradle脚本中添加标签并将文件推送到远程分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55418712/
我是一名优秀的程序员,十分优秀!