Index syndication
comment syndication

Archive for git

Git on 10.04 Ubuntu LTS

This is more for me than you, however if you need Git on Ubuntu 10.04 (LTS) try this. The commands I ran get the pre-packaged PPA Git working on Ubuntu 10.04:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:git-core/ppa
sudo aptitude update
sudo aptitude safe-upgrade
sudo aptitude install git

Clone a part of an SVN repository in git

I was trying to clone my wordpress plugin from the wordpress svn repo using git-svn. I had no luck for about the past 8 weeks, with this problem:


Initialized empty Git repository in /Users/lantrix/tweet/.git/
Using higher level of URL: http://plugins.svn.wordpress.org/tweet => http://plugins.svn.wordpress.org

And it would proceed to hit up the entire wordpress repo.
After reading a possible solution on Charlie’s Old blog, I stubmled across a newer way to do this.

As of v1.6.4 of git, you can now use a –no-minimize-url when doing a git-svn clone. This makes git clone only the part of the repo you want; and the added bonus is you can get all your tags and branches.

Here is how I did it:
[gist id=’1569166′]
git svn clone –prefix=svn/ –stdlayout \
–authors-file=authors.txt \
–no-minimize-url http://plugins.svn.wordpress.org/tweet/
[/gist]

It still took a while to parse all the SVN history, and now of course this stands out in the git-svn doco 😛

The authors.txt file just mapped my svn users to git user/email pair, e.g.:

lantrix = Lantrix
plugin-master = none
(no author) = none

You will probably want to have a look at these set of scripts. Have a read of NothingMuch’s perl blog for extra steps and details on extra svn conversion scripts.

Git branch name in your bash prompt

Here is a quick way to show the current git branch when you are in a repository directory. Place this in your .bashrc or .bash_profile:

[gist id=243856]

I’ve also customised the PS1 to show user/host/path.

You should probably setup git bash completion as well. This can be done by sourcing the bash completion script that is available in the git source code as shown (change path to where you place script):

[gist id=244374]

Have fun.