|
Re: Just do a simple merge [message #1691784 is a reply to message #1690522] |
Thu, 09 April 2015 15:41 |
Christian Halstrick Messages: 274 Registered: July 2009 |
Senior Member |
|
|
What you try doesn't even work in native git. If I understood you right you first triggered a "git pull" which lead to conflicts. And then, in that repo which is still in the middle of a merge and which contains conflicts you trigger a new merge command? This can't work. If you want to start a merge (with JGit or with native git) you shouldn't be in a state where you have unsuccesfully pulled. The best way to try this out is to work with command line git and see what you have to do there. This should tell how to programm it with jgit.
I tried to reproduce what you did with native git. Native git gives you a hint what you have to do after the pull. For those files conflicting you should fix the conflict by "git add" new content. Alternativly you could also checkout OURS or THEIRS for the conflicting files. When done resolving the conflicts you can just "git commit" to finally finish the pull.
+ git init --bare central
Initialized empty Git repository in /tmp/central/
+ git clone central/ bob
Cloning into 'bob'...
warning: You appear to have cloned an empty repository.
done.
+ cd bob/
+ echo -e '1\n2\n3'
+ echo -e '1\n2\n3'
+ git add .
+ git commit -m initial
[master (root-commit) 22cc5a7] initial
2 files changed, 6 insertions(+)
create mode 100644 common1
create mode 100644 common2
+ git push
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 225 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /tmp/central/
* [new branch] master -> master
+ cd ..
+ git clone central/ dave
Cloning into 'dave'...
done.
+ cd bob/
+ echo -e '1bob\n2\n3'
+ echo -e '1\n2bob\n3'
+ echo bobsContent
+ git add .
+ git commit -m bobsChanges
[master 4fec0dd] bobsChanges
3 files changed, 3 insertions(+), 2 deletions(-)
create mode 100644 bobsFile
+ git push
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (5/5), 353 bytes | 0 bytes/s, done.
Total 5 (delta 0), reused 0 (delta 0)
To /tmp/central/
22cc5a7..4fec0dd master -> master
+ cd ../dave
+ echo -e '1\n2\n3dave'
+ echo -e '1\n2dave\n3'
+ echo davesContent
+ git add .
+ git commit -m davesChanges
[master b5118ee] davesChanges
3 files changed, 3 insertions(+), 2 deletions(-)
create mode 100644 davesFile
+ git pull
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 5 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (5/5), done.
From /tmp/central
22cc5a7..4fec0dd master -> origin/master
Auto-merging common2
CONFLICT (content): Merge conflict in common2
Auto-merging common1
Automatic merge failed; fix conflicts and then commit the result.
+ git merge -s ours FETCH_HEAD
error: merge is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
Ciao
Chris
|
|
|
Powered by
FUDForum. Page generated in 0.03076 seconds