Github subtree merge

| | No TrackBacks

I had a GIT problem on GitHub. I had projects in a directory hierarchy like this:

root/src/lang1/project1 root/src/lang1/project2 root/src/lang1/project3 ...

that were in Git locally. Each was a separate Git repository. I then tried to (1) move the source to GitHub and (2) add other projects that were at the same level or higher:

root/src/lang2/project-x root/src/lang3/project-y root/release/... root/docs/... ...

And Git took my intentions the wrong way. Instead of a single hierarchical repository from root/ down, I then had all of the stuff in root/ down except the lang1/ directories were all islands which GitHub thought of as submodules. Except not quite. These projects did not display with subfolders -- they displayed with the submodule icon, but I couldn't get the source from GitHub via them.

The fix was quite easy once I'd contacted tech support at github and exchanged email with Tekkub. He recommended this URL for a description of how to merge a subtree. I ended up with a script like this:

# Put repository at # ../temp/DazUtility/DazUtilitySetup # into subtree at # git remote add -f A ../temp/DazUtility/DazUtilitySetup git merge -s ours --no-commit A/master git read-tree A/master git commit -m "Merge with DazUtilitySetup" git push git remote rm A

Using the ours strategy for the merge did not work with all my projects and I ended up using resolve in one case:

git merge -s resolve --no-commit A/master

One final word: tech support at Github is awesome: fast and knowledgeable with great follow-up.

No TrackBacks

TrackBack URL:

Leave a comment

Verification (needed to reduce spam):


OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.32-en

About this Entry

This page contains a single entry by Hugh Brown published on December 3, 2009 9:44 AM.

I am not much into reading... was the previous entry in this blog.

Comment CAPTCHA compromised on Movable Type and WordPress? is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.