Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » JGit - How to specify commit message for merge commit?
JGit - How to specify commit message for merge commit? [message #1117159] Thu, 26 September 2013 02:38 Go to next message
EungJun Yi is currently offline EungJun Yi
Messages: 1
Registered: September 2012
Junior Member
Is there any way to specify a commit message for a merge commit while merging with MergeCommand?

Or should I merge with Merger and MergeMessageFormat instead of MergeCommand to do that?
Re: JGit - How to specify commit message for merge commit? [message #1118139 is a reply to message #1117159] Fri, 27 September 2013 01:22 Go to previous message
Christian Halstrick is currently offline Christian Halstrick
Messages: 99
Registered: July 2009
Member
Just tell the mergecommand not to commit and only to prepare the merge. Then call commitCommand to specify your commit message. See here:

		Git git = Git.init().setDirectory(...).call();
		RevCommit initialCommit = git.commit().setMessage("initial empty commit").call();
		RevCommit commitOnMaster = git.commit().setMessage("next empty commit").call();
		git.checkout().setCreateBranch(true).setName("side").setStartPoint(initialCommit).call();
		git.commit().setMessage("next empty commit on side").call();

		git.merge().include(commitOnMaster).setCommit(false).call();
		git.commit().setMessage("my special merge commit message").call();



Ciao
Chris
Previous Topic:Can I disable checkout branch on mouse double click?
Next Topic:JGit
Goto Forum:
  


Current Time: Tue Jul 22 15:46:11 EDT 2014

Powered by FUDForum. Page generated in 0.01617 seconds