Is there a way to commit part of modified files (all files are staged) by using libgit2sharp?

StackOverflow https://stackoverflow.com/questions/17742362

  •  03-06-2022
  •  | 
  •  

質問

Is there a way to commit part of modified files (all files are staged) by using libgit2sharp?

There are no Commit method in Repository that takes path parameter.

役に立ちましたか?

解決

Is there a way to commit part of modified files (all files are staged) by using libgit2sharp?

Currently, there's no way to perform a partial staging/unstaging in LibGit2Sharp. I'd suggest you to subscribe to Issue 195 in order to be notified when this is available.

There are no Commit method in Repository that takes path parameter.

Actually, the action of committing consists of taking a snapshot of the Index and creating a durable Commit git object in the object database. As such, the Commit API doesn't accept paths.

In order to create a Commit from a file (or list of files) on your file system, you'd first have to add them to the Index with repo.Index.Stage(), then invoke the repo.Commit() method.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top