0

I figured out how to do a lot of things in the JGit library, such as commit files, find out the status of all files (ie. changed, modified, untracked etc), but i can't figure out how to unstage files i added to the index. Could someone let me know how to do this and maybe point me to some documenation as the eclipse site has none, and i can't find any on Google.

Also if anyone know how to ammend a commit i would much appreciate knowing that too.

Thanks.

Coder
  • 1,375
  • 2
  • 20
  • 45

1 Answers1

0

Looks like you found a way to unstage files but ran into trouble as explained in your other question:

repository.getIndex().remove(getWorkignDirectoryAsFile(), new File(getWorkignDirectoryAsFile(), fileName));
repository.getIndex().write();

Did you solve your issue with the above? I notice that repository.getIndex() is deprecated and org.eclipse.jgit.dircache.DirCache should be used instead.

To amend a previous commit, you should look at

org.eclipse.jgit.api.CommitCommand.setAmend(boolean)

Would be great if you could report on your own answers if you found any.

Community
  • 1
  • 1
fmjrey
  • 1,141
  • 1
  • 10
  • 16