Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » JGit - How to specify commit message for merge commit?
JGit - How to specify commit message for merge commit? [message #1117159] Thu, 26 September 2013 06:38 Go to next message
EungJun Yi is currently offline EungJun YiFriend
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 05:22 Go to previous message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 274
Registered: July 2009
Senior 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: Wed Apr 24 22:00:47 GMT 2024

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

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

Back to the top