0

I'm trying to get used to libgit2 and so am making simple git app. I know git rm --cached <filepath> is removing the file from index (eg git_index_remove_bypath(idx, path)). Now am looking for git reset <filepath>

Does libgit2 have an example or some documentation on how to reset file to previous state aka unstage? The best explanation I found is this one but I really didn't get what he meant.

Any pointer or even example is appreciated

Stefano Mtangoo
  • 6,017
  • 6
  • 47
  • 93

1 Answers1

1

To unstage a file you want to write the current HEAD commit entry for the file into the index with git_index_add. See my answer to this question for some details.

Community
  • 1
  • 1
Jason Haslam
  • 2,617
  • 13
  • 19