Hi, for those who don't know, TopGit[1] is a patch management system on top of git; basically what it offers is an easy way to track dependencies between git branches and export them to patches, so I tried to use it to manage my dot-files using one branch per program (a branch for vim files, a branch for bash files, etc.) having them merged together like in a "union" operation into a single branch.
I wrote a Makefile (attached) to automate some tasks, and I've written a tutorial explaining how it works, temporarily here: http://shell.studenti.unina.it/~ospite/tmp/README.html I am also attaching the .txt version of the tutorial in case you want to quote something from it on reply. This is meant mainly for discussion as I still see some fragility in this approach, maybe on the long run having topgit messing up with the history could even nullify the point of having the files under version control at all; and I have also some doubts about working on such a repository in a collaborative way. Anyhow, I spent some hours putting the experiment together and I just wanted to share it and ask for your opinion, as there are people here who have been thinking to similar problems for a longer time than I have. I suspect I'll end up putting all my dot-files in a single repository with a rather flat structure, eventually :) Thanks, Antonio [1] http://repo.or.cz/w/topgit.git -- Antonio Ospite http://ao2.it PGP public key ID: 0x4553B001 A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing?
DotFiles with TopGit ==================== Antonio Ospite <[email protected]> v1.0, March 2011: First version. An experiment on managing dot-files with TopGit (http://repo.or.cz/w/topgit.git) Goals: - Manage different sets of configuration files in one repository - Avoid calling programs other than make and git directly as far as possible - Have private or âlocalâ configuration files - Have a .gitignore file for generated files - Copy configuration files to remote hosts Non-requirements: - I don't need to track the files directly into '$HOME': keeping a copy around is fine as long as I can easily diff with the actual files in '$HOME' The sets of configurations files will be represented with git branches, and a few special branches will perform a "union" operations on these sets producing something resembling what we want to track in the '$HOME' dir. TopGit has to be used by those who want to push to the remote repository eventually, but will not be needed for those who just want to clone the repository to reuse what is in it. The drawback of using TopGit is that the history gets polluted with a lot of Merge commits, but using 'git log --no-merges' alleviate this problem. Tutorial -------- Legend - lines starting with '$' are shell commands - the symbol '*' in the branch layouts marks the currently active branch - if the prompt looks like '[branch-name]' this is a topgit prompt shown when there are conflicts to solve Initialize the repository ~~~~~~~~~~~~~~~~~~~~~~~~~ $ make init Start tracking vim dot files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $ make add-vim We get the branch layout below +------------+ | dot-files | +------------+ | | v +--------------+ | * tg/dot-vim | +--------------+ | | v +------------+ | master | +------------+ and we can now start tracking vim configuration files $ cp ~/.vimrc dot-vimrc $ cp -r ~/.vim dot-vim $ git add dot-* $ git commit Start tracking bash dot files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $ make add-bash We get the layout below: +------------+ | dot-files | +------------+ / \ / \ v v +------------+ +---------------+ | tg/dot-vim | | * tg/dot-bash | +------------+ +---------------+ \ / \ / v v +------------+ | master | +------------+ and we ca start tracking bash confiration files $ cp ~/.bashrc dot-bashrc $ cp ~/.bash_profile dot-bash_profile $ cp ~/.inpurtc dot-inputrc $ git add dot-* $ git commit Update the "union" branch ~~~~~~~~~~~~~~~~~~~~~~~~~ Update the topmost branch called 'dot-files' and install the configurations files $ make update Check what are the differences between what is in the repository and what is in '$HOME': $ make diff Finally install the version in the repsoitory replacing the on ein '$HOME' $ make install Start a local bash branch ~~~~~~~~~~~~~~~~~~~~~~~~~ $ make local-bash We get the layout below: +-----------------+ | dot-files-local | +-----------------+ | \ | \ | v | +---------------------+ | | * tg/dot-bash-local | | +---------------------+ v | +------------+ | | dot-files | | +------------+ | / \ | / \ | v v v +------------+ +-------------+ | tg/dot-vim | | tg/dot-bash | +------------+ +-------------+ \ / \ / v v +------------+ | master | +------------+ Add some personal setting $ echo "[ -e .bashrc-local ] && source .bashrc-local" >> dot-bashrc $ echo "[email protected]" > dot-bashrc-local $ git add dot-bashrc-local $ git commit -m "Add a local bashrc" Update all the configurations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This will update the 'dot-files-local' branch and all its dependencies and install all the configurations files. $ make update-all $ make install Push all the changes to a remote repository ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $ make push This will *NOT* push the local stuff to the public repository Resolving merge conflicts ------------------------- In particular if you change Makefile or README.txt while in the master branch, you are likely to get conflicts when calling 'make update'. To solve this keeping the changes from master just run these commands at the topgit prompt: [tg/dot-vim] git checkout --their Makefile README.txt [tg/dot-vim] git add Makefile README.txt [tg/dot-vim] git commit [tg/dot-vim] exit
pgpn0irQA2EPn.pgp
Description: PGP signature
_______________________________________________ vcs-home mailing list [email protected] http://lists.madduck.net/listinfo/vcs-home
