Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » committing single files with jgit/API(command line function not implemented ?)
committing single files with jgit/API [message #1702876] Mon, 27 July 2015 07:08 Go to next message
Christoph Schmidt is currently offline Christoph SchmidtFriend
Messages: 1
Registered: July 2015
Junior Member
There are special cases, where I need to commit single files - and not all the changed files known by the index.

A commit .call() would commit all changed files - right ?
On the command line I would be able to tell git :
git commit -m 'some single files where changed' file1 file2 file3

(even if file0 and file 4 would be in the index and would have changes)
I would like to know, how I can tell this to git via jgit.

Thanks
Re: committing single files with jgit/API [message #1703188 is a reply to message #1702876] Wed, 29 July 2015 08:16 Go to previous message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 274
Registered: July 2009
Senior Member
CommitCommand has
setOnly(path)
. You can call it multiple times to add all those pathes which you want to have in the commit. E.g.
git.commit().setOnly("src1").setOnly("a.txt").setMessage("First commit").call()

Why do you add files to the index if you don't want them in the next commit?


Ciao
Chris
Previous Topic:NPE on checkout if there are two branches on the commit
Next Topic:InternalException: combination of --all and --only not allowed
Goto Forum:
  


Current Time: Tue Sep 24 02:20:13 GMT 2024

Powered by FUDForum. Page generated in 0.04150 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top