keth keth - 1 year ago 91
Git Question

grgit - to add new files and remove deleted files

we are using grgit to update files in github.

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

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

Answer Source

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(update: true)
grgit.add(patterns: ['src'])
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download