Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » List conflicts prior to pull or merge(Check wether a file will be in conflict state if a pull command is performed)
List conflicts prior to pull or merge [message #1693228] Wed, 22 April 2015 13:53 Go to next message
Fábio Silva is currently offline Fábio SilvaFriend
Messages: 18
Registered: December 2014
Junior Member
Is there a way to list all possible conflicts without performing a merge or pull? I want to check possible conflicts prior to a pull request. The git documentation alerts that keeping your unstaged changes after aborting a merge may not be possible , so I'm looking for a secure way of doing this.
Re: List conflicts prior to pull or merge [message #1694025 is a reply to message #1693228] Thu, 30 April 2015 07:36 Go to previous messageGo to next message
Patrick Peer is currently offline Patrick PeerFriend
Messages: 4
Registered: April 2015
Junior Member
I can see why you want this feature. However, if you shift your view of things slightly towards the "git way", you will see that this use case is obsolete Wink

One usually wants to have a clean repository before doing a merge or a pull (which, ultimately, is a merge as-well). Clean means no unstaged/uncommitted files. The easiest way to achieve this is, of course, to commit the changes. Remember: A commit is just a mechanism to group a set of changes, and no one else but you will see those (committed) changes until you push them to the remote branch. As an alternative you could also stash, but this only makes sense in race circumstances.
With a clean repository you need not fear to lose any work you have done. Then, if you decide to abort the merge mid way (maybe because you just cannot be bothered to resolve the conflicts right now) you will always be safe and a preview becomes obsolete Wink

tl;dr
Follow the mantra commit early, commit often!

[Updated on: Thu, 30 April 2015 10:47]

Report message to a moderator

Re: List conflicts prior to pull or merge [message #1703473 is a reply to message #1694025] Fri, 31 July 2015 22:06 Go to previous message
David Bekel is currently offline David BekelFriend
Messages: 4
Registered: July 2015
Junior Member
Use the setCommit() method -
 
MergeCommand dryMergeCommand = git.merge()
MergeResult  dryMergeCommand.setCommit(false).call()
Map<String, int[][]> conflicts = oDryMergeResult.getConflicts(); 
Previous Topic:InternalException: combination of --all and --only not allowed
Next Topic:Binary files differ: Cannot diff UTF16 files in GIT history
Goto Forum:
  


Current Time: Fri Apr 26 09:13:16 GMT 2024

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

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

Back to the top