Go to content Go to menu

So, my goal with this work is to be able to have a set of DSpace themes in their own repositories on GitHub, so I can then include them in my own DSpace repository as submodules .

Credit where credit is due, I used the suggestions on these pages for inspiration:
stackoverflow:extract-part-of-a-git-repository
airbladesoftware:moving-a-subdirectory-into-a-seperate-git-repository

However, this page is the one I finally selected as my guide:
stackoverflow:detach-subdirectory-into-seperate-git-repository

Here is the process I followed, in order to extract this recent version of the Mirage theme (Note, the following will extract just the Master/HEAD history for the Mirage theme, and will drop all branches and tags… the resulting repository will be useful as an include/subrepository for a project which is following Master, but won’t be useful for an older code base).


git clone git@github.com:hardyoyo/DSpace.git mirage
cd mirage
git remote rm origin #let's avoid inadvertant pushes back to origin, shall we?
git tag -l | xargs git tag -d
git filter-branch --tag-name-filter cat --prune-empty --subdirectory-filter dspace-xmlui/src/main/webapp/themes/Mirage HEAD
git reset --hard
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
git reflog expire --expire=now --all
git gc --aggressive --prune=now

This same tactic should work for pulling out any theme from any repository… now just to figure out how to use it. First, let’s put it up somewhere:

  1. create a bare repo on GitHub (in this example, I’ve called it “mirage”
  2. enter the following at the root of the extracted repository created in the steps outlined above:

git remote add origin git@github.com:your-github-user-name/mirage.git
git push -u origin master

If you’re curious about how you might make use of this extracted theme, read Git Tools – Submodules (apologies for the odd formatting above, I’m still not quite used to Textile, and I can’t figure out how to get two blocks of code into the same article… argh!)


So, here I was, trying to cherry-pick some pull requests for DSpace 3.0 into my DSpace 1.8.2-based code base, and I get TONS of merge conflicts. Which brings me face to face with two facts: 1) I probably should just bite the bullet and upgrade to 3.0 if I really want 3.0 features; 2) I really need to configure a visual merge tool. Back when I was still developing on a Windows computer, I used WinMerge. But I’ve been merging by hand ever since I moved to Mac. Time to actually set up a proper merge tool. I asked around, and was pointed at Meld, which appeared to be ready to go in MacPorts, but I ran into a wall trying to get it working. Then, I remembered reading something about someone using the Perforce merge tool, and googling around, I found this how-to: Using p4merge as a git mergetool It works great. Yay!