|
|
|
|
Re: aborting a conflicted merge [message #1732046 is a reply to message #1729410] |
Thu, 12 May 2016 08:34 |
|
Matthias Sohn wrote on Wed, 13 April 2016 18:11
no, maybe you want to contribute this ?
I can try, I will start to study the code to learn how to do that.
In the mean time, how can I work around this? I mean, since I tried to execute a merge and it ran into conflicts, how to undo the merge attempt in order to be able to proceed with other operations with the repository?
|
|
|
Re: aborting a conflicted merge [message #1732093 is a reply to message #1732046] |
Thu, 12 May 2016 13:55 |
|
I tried to run git merge --abort with Runtime.exec() but it ends with the following message:
Quote:error: Entry '<filename>' not uptodate. Cannot merge.
fatal: Could not reset index file to revision 'HEAD'.
This is what I have tried:
// Option 1
static final String ABORT_CMD = "git merge --abort";
static final String[] ABORT_ENV = { "GIT_PAGER=cat" };
Runtime run = Runtime.getRuntime();
Process pr = run.exec(ABORT_CMD, ABORT_ENV, repositoryPath);
pr.waitFor();
// Option 2
ProcessBuilder pb = new ProcessBuilder("git", "merge", "--abort");
pb.directory(repositoryPath);
Process pr = pb.start();
pr.waitFor();
In both ways, I have got the same message.
|
|
|
|
Re: aborting a conflicted merge [message #1732194 is a reply to message #1732149] |
Fri, 13 May 2016 11:38 |
|
It seems to have worked for my purpose.
I had already tried this but without setref() to such commit.
by the way, would u mind to explain the difference between both approaches ("git reset <sha1>" and "git merge --abort")? I have found this, which left me wondering whether the latter is an alias for the first one or not.
|
|
|
Powered by
FUDForum. Page generated in 0.03428 seconds