user1815597
user1815597

Reputation: 53

How to do the equivalent of 'git rm' with libgit2?

Using libgit2, I am able to do the equivalent of git add with git_index_add, but I am struggling to figure out how to achieve the equivalent of git rm on a file that has been deleted.

Upvotes: 1

Views: 345

Answers (1)

Carlos Martín Nieto
Carlos Martín Nieto

Reputation: 5277

You do that with the git_index_remove function. As stage you'll probably want 0 (assuming you're not dealing with conflicts). It doesn't matter whether the file exists on the filesystem or not.

Upvotes: 1

Related Questions