BitBucket or GitHub? Use both!

Posted: 2010-07-24
Category: Git

Over the last few months I have seen several discussions by several developers - especially in the CodeIgniter community - about wether or not to convert their GitHub repo's over to BitBucket. I say: why not use both?

That may initially sound confusing and like a lot of hard work, but using the brilliant Hg-Git plugin from the GitHub developers it really has been made easy to do. Essentially the Hg-Git plugin allows Hg to talk to a Git repository like it was a Mercurial repo.

I have recently done this with pretty much all of my repositories as I was split half and half between the two. Some code on GitHub and some on BitBucket. Now pretty much everything can be found on both profiles, including Modular Separation, Template and Dwoo parser. Even my CodeIgniter fork is on both!

A picture says a thousand words, a video says a gajillion more:

iPhone version

For those of you who don't have time to watch the whole video, or if you can't stand my accent here are the basic commands:

$ hg clone git+ssh://[email protected]:philsturgeon/codeigniter-prowl.git
$ mv codeigniter-prowl.git codeigniter-prowl
$ cd codeigniter-prowl
$ vim .hg/hgrc

When you are in the config edit mode change default = to github = then add a new line with your BitBucket ssh repo address. Then you can change some code and (without having to use a staging area you) you can simply do:

$ hg commit -m "Stuff changed"
$ hg push github
$ hg push bitbucket

The one and only niggle I have spotted so far is that you can't delete your Git tags on a remote repo. I don't see that to be a major issue as normally you wouldn't need to delete one, you'd simply re-tag and push over the top. If you do the only option I have found is to quickly git clone your repo and remove it with git push origin :tagname.

Give this a try and let me know how it goes for you. I find it really helpful, do you?

Comments

Gravatar
Coolgoose

2010-07-26

This is really nice, i was lazy on switching between github/bitbucket to check your different repos :P

Gravatar
Ebrahim

2010-07-29

I once suggested BitBucket guys to implement forking directly from GitHub. But they told me GitHub guys will probably not like that!

Gravatar
Julien Mcardle

2012-02-12

That's pretty useful. I've been doing all of my work with BitBucket, but many people (potential employers) like to see a presence on GitHub. Pushing commits to both seems like a win-win.

Posting comments after three months has been disabled.