Adding Prezto as a Submodule to Dotfiles

When I set up prezto recently, I took a clone of the prezto repo to ~/.prezto. That works fine, however now I want to keep the prezto files in my dotfiles repo.

I have a dotfiles repo on github, a pretty common practice for keeping all your dotfiles versioned and easily reusable across machines.

So I want to add my prezto configuration files to it. There’s a number of different ways I could do this. I could copy all of prezto into my dotfiles folder, but that adds to a lot of duplicated files that I’d have to update manually. That’s a bad idea. I could clone the prezto repo and copy the various rc files into my dotfiles and keep just those files versioned there, and manually merge in any updates made to the rc files on the prezto master into my versioned rc files. That’s a bit better but seems kind of a shame to have them split out like that, and I still have to manually merge the rc files.

Another alternative is to add the prezto project as a submodule to my dotfiles project. That means all of prezto is included in my dotfiles repo, but it’s a reference to the original project, that my own out-of-sync copy of it. That’s a lot better but still I have the issue of versioning my rc files. I couldn’t amend the ones in the prezto submodule. I could have separate copies of them in my dotfiles which are versioned, but then it’s not much better than the 2nd option, I just have the rest of prezto contained in my dotfiles. Which is arguably a bit pointless – why have the framework code in my dotfiles folder?

As I’d already forked the prezto repo in order to submit a pull request

fork repository…

add a link or show how on github…

set upstream tracking

… so we can get latest updates and pull them in to our fork

add to dotfiles as a submodule

git submodule add git@github.com:ngm/prezto.git

updating the submodule

update to latest version somehow…

Comments