views:

48

answers:

1

I am trying to use git as something it wasn't made for - a database. Please feel free to tell me that this is a stupid idea.

Setup

One branch (let's call it robot) is being updated automatically by a script on a daily basis. The data comes from some other publicly available database.

Initially the master branch is the same as the robot branch.

Some of the data in the publicly available database is wrong, so I'll make a commit to the master branch and correct the error.

When the script detects any changes on the public database in the future, it will add those to the robot branch as a new commit (there's one commit per file).

Keeping track of differences

Now, I've obviously lost the ability to do a fast forward merge if I've modified the same file. But I could still cherry pick the good changes in the robot branch and import them into the master branch. The problem is that this might get rather messy after a while, when almost all the files have diverged.

How can I keep track of the difference between the different branches in a systematic way?

+2  A: 

It sounds like you're looking for the git rebase command. This command allows you to update changes you've made to your master branch on top of the new head of the robot branch:

git checkout master
git rebase robot

There may be conflicts, if the database has been updated with a change to something you've changed in master. You must resolve those conflicts manually.

Greg Hewgill
I think you're right ;-) *playingaroundwithit*
hanno
The only problem is that people wont like it when I do this on a remote branch.
hanno