简体   繁体   English

grgit-添加新文件并删除已删除的文件

[英]grgit - to add new files and remove deleted files

we are using grgit to update files in github. 我们正在使用grgit更新github中的文件。

def grgit = Grgit.open(dir: repoDir)
    grgit.add(patterns: ['src'], update: false) // False should even add new files
    grgit.commit(message: 'Updated subsets', amend: false)
    grgit.push()

we checkout from git and delete, add, modify files in a directory and commit and push directory back to github. 我们从git检出并删除,添加,修改目录中的文件,然后提交并将目录推回github。

now while we do grgit.add and keep update:false it Add new files but doesn't remove deleted files. 现在,当我们执行grgit.add并保持update:false时,它会添加新文件,但不会删除已删除的文件。 and if we do update:true it doesn't add the new files and only do changes to tracked files. 如果我们执行update:true ,则不会添加新文件,而只会更改跟踪文件。

how to add and remove files together like git add -A in grgit. 如何一起添加和删除文件,例如git add -A在grgit中。 please help 请帮忙

Grgit is based on JGit, which does not currently have an equivalent to git add -A . Grgit基于JGit,它目前不具有 git add -A 的等效 git add -A

You have to do this as two separate steps: 您必须通过两个单独的步骤执行此操作:

grgit.add(patterns: ['src'], update: true)
grgit.add(patterns: ['src'])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM