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.

2 Answers 2

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" 
Sign up to request clarification or add additional context in comments.

1 Comment

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.
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

2 Comments

Is "git ci" an alias for git commit? It would be better to avoid non standard alias.
It is. Thanks for the heads up

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.