Firefox – Put browser bookmarks into version control system

bookmarksbrowserfirefoxgit

I regularly use three different computers. I keep a lot of data between them in sync using git. This works very well for most purposes.

My only problem is browser bookmarks. Firefox now keeps them in some sort of sqlite database. I could put this into git, but operations like merging then become worthless.

I have looked at a lot of bookmark sync extensions. Currently I use Xmarks, which is the best one, but even it is annoying in some ways. (For instance it now insists on having me log in every time I start up the browser.)

Online bookmarks suffer from various flaws, foremost that the user interface for them typically is terrible compared to the one built in to browsers.

Are there any good ideas for seamless ways to get bookmarks into version control like git? This would be so much simpler if Firefox just kept the bookmarks in a plain text or HTML file rather than in sqlite. So far I can only think of two solutions. One, dump Firefox for another browser. Unfortunately Chromium likely won't be much help as I think it uses a database too. There is uzbl, which would certainly keep bookmarks as plain text, but I would rather not go that route if I can help it as it's a lot of work to get uzbl working. Two, just keep bookmarks in my own plain text file that I can edit with vim. I could do a simple tagging system using awk. This doesn't get me much of a user interface, but this is really the best idea I can come up with so far.

Best Answer

Two options available within Firefox itself:

Go to (in versions < 4) Bookmarks>Organize Bookmarks or (in 4+) Bookmarks>Show All Bookmarks. There will be a button-dropdown for backing up/restoring/importing bookmarks near the top of the dialog box that appears. There will be options to export your bookmarks as either a JSON file or an HTML file. Restoring from the JSON file will completely replace the current bookmarks, while importing the HTML file will just add all the bookmarks to the Bookmarks menu.

I think the HTML version might be better for merging bookmark files, but would require you to delete all the current bookmarks in Firefox before importing the most recent HTML file to avoid all the duplication that would occur. The JSON version does not have that problem, but I'm not sure how well-suited it would be to merging, as it doesn't use line beaks.

UPDATE:

Just noticed that Firefox 4, at least, offers the option to sync bookmarks, etc. Go to Tools>Options and select the "Sync" tab.

Related Question