Say you have a file in a git repository:
What APIs should be used to create a commit that removes that file? For example in this question the file is committed without creating it on disk. Is it now possible to remove that file without using the index (stage area)?
I was expecting a similar flow, maybe creating a git_tree_entry
for the tree builder, but that does not seem to be the case. git_reference_list()
does not list files, so there's a dead end. Also searching the sources for delete and remove got me no success.
Removing a file is similar to adding a file - you remove the index entry to stage the delete, then you can create a commit from the index.
You probably want to use git_index_remove_bypath
, which will remove the file from the index and resolve any conflicts that file had.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With