简体   繁体   中英

grgit - to add new files and remove deleted files

we are using grgit to update files in 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.

now while we do grgit.add and keep update:false it Add new files but doesn't remove deleted files. and if we do update:true it doesn't add the new files and only do changes to tracked files.

how to add and remove files together like git add -A in grgit. please help

Grgit is based on JGit, which does not currently have an equivalent to git add -A .

You have to do this as two separate steps:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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