I played with git branches a bit. I had my proj2 working and so I wanted to play around with it and try out several different ideas for improvement. I also wanted to play around with git branches since that claims to be one of it’s strengths. After monkeying around with PFD for a couple hours Friday night I ended up with half a dozen different branches one for each of the different algorithms I was playing with. Normally I would just end up with file.0.cpp, file.1.cpp, etc. especially when using cvs or the like where branching is more like losing a finger than helpful. That file.0, file.1 etc method also has the added tediousness of requiring addition makefile mods, or else you have to cp file0.cpp to file1.cpp then make, you know what I mean. Everyone has their own way of doing this…
So it’s quick and painless to switch back and forth between versions sure enough. (Just that alone was not really an viable option with cvs et al.) Only thing is, you have to commit any changes before you switch branches or you lose them. At least it won’t allow to blow away your changes to a tracked file by switching. But, in a way this kinda defeats one purpose of easy branching, at least as I heard the pitch. Idea was you could quickly switch back and forth between branches trying out different versions of a program. I assumed that meant while you’re in the midst of modifying one or more of those branches a.k.a. you’re not ready to checkin any of those changes just yet, but you just want to try something in one branch, then go and try it in another, etc.
Well I tried that a number of times, bouncing back and forth. I quickly realized the above commit requirement and so, I went ahead and started committing little changes into a branch (even if the modes weren’t really baked – it was a branch so, who cares?), then switching to another branch. It turned out to be not much of hindrance at all as far as switching to a branch, trying out some mods, committing them, switching to another branch etc.
There are a few things though; I ended up with about 8 or 10 different data input files for feeding my program, one with a very simple case to use while debugging, one to compare with a known working version, etc. etc. So, I naturally want to keep these 10 data files in git. So I do that. But I noticed that, once I had 6 different branches to maintain, and then I added a data file to git, then I had to manually merge that new data file into each branch. Ugh. No good. Surely there is a way around this. Basically how to push a file from master into all or several branches easily? More to learn…