FredyC
FredyC

Reputation: 4067

Git merge while switching to submodule

We are using Qooxdoo framework in our application. For now, it's copy is stored in our Git repository in the root folder "qooxdoo". We have decided to replace that with submodule pointing directly to GitHub Qooxdoo repository, so we can checkout new versions in future more easily.

I created branch for these changes based on master, called qooxdoo-update. Removed old folder completely and added submodule for qooxdoo.

git rm -r qooxdoo
git submodule add git://github.com/qooxdoo/qooxdoo.git qooxdoo

So far this works pretty good. However problem arise when I want to merge master into this branch to keep it updated till other developers can test their code againts new version.

While still in qooxdoo-update branch I issue command:

git merge origin/master

CONFLICT (file/directory): There is a directory with name qooxdoo in origin/master. Adding qooxdoo as qooxdoo~HEAD

then...

git status
Unmerged paths: (use "git add/rm ..." as appropriate to mark resolution)

   added by us:        qooxdoo

running...

git rm qooxdoo
qooxdoo: needs merge
rm 'qooxdoo'
Unlink of file 'qooxdoo' failed. Should I try again? (y/n)

or...

git add qooxdoo
error: unable to index file qooxdoo
fatal: updating files failed

So i am not really sure how to resolve that conflict to successfully finish merging.

Upvotes: 5

Views: 3147

Answers (2)

kenorb
kenorb

Reputation: 166457

If you want to come back to the previous recent version of your file/dir, executing:

git reset HEAD qooxdoo

should work.

Upvotes: 1

The git rm -rf qooxdoo command should have been done in its own commit, followed by the submodule addition. That will tell git (when merging from master into branch) about the intentions. Currently, the same commit being merged is just replacing the files/contents - so git gets confused. Any chance you can replay the master commit?

Upvotes: 0

Related Questions