Time to git collaborating with git_remote_branch
git_remote_branch 0.2.6 is out!
I’ve just released a new and improved version of git_remote_branch. Code named 0.2.6!
Ok, I admit. I haven’t really begun using code names.
I’m promoting the project from a pre-alpha to an alpha release. There’s still a lot to do, but the stability and “testedness” have improved greatly. Following are both sides of the maturity story.
The project is maturing
- grb got its first contributor, Caio Chassot
- I added a lot of tests, both unit and functional
- the gem can now be installed directly from RubyForge
- git_remote_branch now has a Google Group
The project is still immature
- it swears a lot
- no rubyforge page, despite the project being on rubyforge (at rubyforge.org/projects/grb)
- no real documentation other than running grb help
- very little in code documentation. On the other hand the code is spectacularly clean and readable, so that’s completely unnecessary. Just kidding.
What’s new in 0.2.6?
Three new actual features
- the ‘rename’ command, contributed by Caio Chassot
- the ‘publish’ command
- the −−silent option to completely mute grb output as well as every git command run by grb on your behalf
And other stuff
- the grb bin file now works when symlinked (also thanks to Caio Chassot)
- lots of unit and functional tests
- bug fixes
- more flexibility for running grb outside of a git repository (e.g. for ‘explain’ or ‘help’)
- now officially under the MIT license
- refactored a bunch of rake tasks
Git the new version
To install the newest version of the gem, simply run
sudo gem install git_remote_branch
If you really want to be on the bleeding edge you can also get it on GitHub. Note however that in ‘bleeding edge’ the word ‘bleeding’ is still the most important one at that point.
git clone git://github.com/webmat/git_remote_branch.git cd git_remote_branch rake install
The ‘install’ task will run the tests before installing so you’ll need Shoulda, mocha, redgreen and ruby-debug for that approach.
Not familiar with git_remote_branch?
What it is
The basic idea for git_remote_branch is to trivialize the interaction with remote branches. The first goal is to make the commands for the simple situations easy.
The secondary goal, is to help you learn the commands by seeing them displayed in a beautiful shade of red each time you use grb, along with git’s output.
git_remote_branch lets you
- create local-remote branche pairs, and tracks the remote branch automatically (for automatic merges when you git pull)
- publish a local branch as a remote branch, very similar to create
- delete local-remote branch pairs
- track a remote-only branch
- rename a local-remote branch pair
- explain by simply spitting out the necessary commands to do any of the above
How to use it
If you simply want to use grb as a cheatsheet (and run nothing on your behalf), you can use the explain command:
$ grb explain create git_remote_branch version 0.2.6 List of operations to do to create a new remote branch and track it locally: git push origin current_branch:refs/heads/branch_to_create git fetch origin git branch −−track branch_to_create origin/branch_to_create git checkout branch_to_create
$ grb explain create my_branch my_origin git_remote_branch version 0.2.6 List of operations to do to create a new remote branch and track it locally: git push my_origin current_branch:refs/heads/my_branch git fetch my_origin git branch −−track my_branch my_origin/my_branch git checkout my_branch
Notice that you can specify any normally expected parameter you’d normally include and ‘explain’ will use them in the list of commands it suggests.
Even better, if you’re in your repository, the current branch is going to be taken into account:
(master) $ grb explain create my_branch my_origin git_remote_branch version 0.2.6 List of operations to do to create a new remote branch and track it locally: git push my_origin master:refs/heads/my_branch git fetch my_origin git branch −−track my_branch my_origin/my_branch git checkout my_branch
Of course, ‘explain’ works for all commands: create, publish, delete, track and rename.
The main commands
I’m not going to painstakingly give an example for each command. I’ll only give two, to show how git’s responses are displayed when running grb without ‘explain’:
(master)$ grb create test_branch git_remote_branch version 0.2.6 git push origin master:refs/heads/test_branch Total 0 (delta 0), reused 0 (delta 0) To [email protected]:webmat/git_remote_branch.git * [new branch] master -> test_branch git fetch origin git branch −−track test_branch origin/test_branch git checkout test_branch Switched to branch "test_branch" (test_branch)$ grb delete test_branch git_remote_branch version 0.2.6 git push origin :refs/heads/test_branch To [email protected]:webmat/git_remote_branch.git - [deleted] test_branch git checkout master Switched to branch "master" git branch -d test_branch (master) $
Yes my friends, I have just boldly used grb on my real repository for your viewing pleasure.
But worry not, no repository was hurt during the writing of this article.
For any feedback you’re of course welcome to
- comment on this article
- post in the google group
- To Caio Chassot for the code contribution
- To the Thin team for a good inspiration on how to help manage gem creation and deployment with rake;
- Feedback from James Golick in day to day collaboration as well as all the people that commented on the initial announcement of git_remote_branch;
- To Chris Wanstrath (defunkt) from the GitHub team for pimping of the initial announcement of grb on the GitHub blog.