GitPython - Add modified, deleted, untracked to Git Repository

Viewed 4558

I thought somehow update=True will add all modified, deleted and untracked files to the index. I am not sure what the way is. Can someone help me here?

repo = Repo(working_repository_url)
repo.git.add(update=True)
repo.index.commit(my_msg)

I mean. I can certainly get the :

untracked_items = repo.untracked_files

and this is only for the untracked files. I want to add untracked files, deleted, modified files to the index and then do a commit to all.

More likely I am looking something that is equivalent to git add --all

Anything can be helpful.

Thanks!

2 Answers

Try

repo.git.add(all=True)

It's one-to-one correspondence for git add --all

To keep using repo.index:

repo.index.add('**')
Related