1

I have cloned a git repo which has my emacs config files in. I would like to add pylookup in a subdirectory. What is the correct way to do this?

Below are the options I can think of.


  1. If I clone it into ~/.emacs.d/pylookup/ and add that folder to my emacs repo, will that update properly when I do:

    cd ~/.emacs.d/pylookup/
    git pull
    cd ~/.emacs.d
    git commit -a -m "updates to pylookup"
    git push
    

    i.e. when I pull those changes on my other machines will I have the new version of pylookup?

  2. Do I simply get my emacs repo to ignore pylookup/* and update it on every machine whenever pylookup is updated. This would get annoying if there was a few repo's and a few machines but I can live with it.

  3. Is there some smart tricks with git submodule. If so could you provide an explanation I didn't really understand the documentation. How would I pull changes for emacs and for pylookup.

  4. Do I go with answer 2 but make a script to update all sub-repos. If I did that I could run that once on each machine every time pylookup changed.


Couple of possible related posts.

Community
  • 1
  • 1
James Brooks
  • 4,135
  • 4
  • 26
  • 25

2 Answers2

5

If you create a Git submodule:

$ git submodule add git://github.com/tsgates/pylookup.git pylookup
$ git submodule init pylookup
$ git submodule update pylookup

Let's say there are some changes to pylookup and you want to get them:

$ cd pylookup
$ git pull origin master
$ cd ..
$ git add pylookup
$ git commit -m "Track new commit of pylookup"
Ben James
  • 121,135
  • 26
  • 193
  • 155
  • Good answer. What happens on my other computer when I do pull the emacs changes. i.e. do I have to update pylookup on every machine. – James Brooks Dec 04 '09 at 14:17
0

I used subtree merge with a similar problem - http://git-scm.com/book/en/Git-Tools-Subtree-Merging. Something like:

$ git remote add -f pylookup /path/to/pylookup
$ git merge -s ours --no-commit pylookup/master
$ git read-tree --prefix=pylookup/ -u pylookup/master
$ git ci -m "merging pylookup into pylookup subdirectory"

Good guide here: http://jasonkarns.com/blog/merge-two-git-repositories-into-one

kallsey
  • 63
  • 1
  • 6