Zeno's Notes

...

1 note

Today I learned …

… some new things about git: How to push things to remote branches, and how to push things to several remote repositories at once¬†(thanks to Carsten for the hint).

Remote Branches

Currently, I am re-working some underlying data structures of MyMediaLite, the recommender system library that I (well, mostly me) develop. This breaks things BIG TIME, and for quite a while. In other words, a really good case for branching.

I knew how local branching and merging works, but I had no idea how to push the contents of branches to a remote repository without pushing it to the remote master branch.

It turns out it is quite easy:

git push git@gitorious.org:mymedialite/mymedialite.git new_ratings:new_ratings

Well, everything looks easy with git once you find out how to do it. It was not obvious to me, and reading the man pages also did not really help.

Pushing to Several Remote Repositories

My other problem was that I wanted to keep both the gitorious as well as the github repository up to date. StackOverflow had the answer. This is how it looks in my .gitconfig file:

[remote "MML"]
    url = git@gitorious.org:mymedialite/mymedialite.git
    url = git@github.com:zenogantner/MyMediaLite.git

I can then use the MML alias to push to both repositories:

git push MML

Combining Both Features

And guess what, of course the two features can be combined without a problem:

git push MML new_ratings:new_ratings

Filed under git version control mymedialite github gitorious

  1. zenoga posted this