Host a TextMate Bundle on GitHub
Create a repository on GitHub
Go into the Bundle Editor and drag your bundle to your desktop and cd into it in the terminal. This is the key to the whole thing. If you just go into the bundle where it lives in TextMate, you might not get everything it needs. Dragging the file to the desktop makes it a nice, happy package ready to help other people.
Follow GitHub’s instructions to set up and push to the remote repository. Don’t forget to git add . to get everything in there.
Delete your original bundle and then clone from GitHub like so:
cd ~/"Library/Application Support/TextMate/Bundles/"
git clone git://github.com/trey/trey-tmbundle.git "Trey.tmbundle"
osascript -e 'tell app "TextMate" to reload bundles'
When you make changes to your Git-ified bundle in the Bundle Editor, you’ll need to Reload Bundles for the changes to show up in your repository. Then you’ll need to git add . and commit / push as you would a normal repository.
Source
Using Someone Else’s SVN Repository with Git
If you have a repository URL that looks like this:
http://code.yourmom.com/project/trunk/
Issue this command (note that you leave off trunk/):
git svn clone -s http://code.yourmom.com/project/ project
After it’s done, see how big it is:
du -hs project
And you’ll see something like this:
20M project/
If it’s particularly big, go into the folder and garbage collect:
cd project
git gc
From within the project folder, set your local repository to the trunk (it’s set to whatever branch had the last commit otherwise):
git reset --hard trunk
Create your own branch and get to work:
git co -b treys_changes
When you want to pull in the changes from the original author to stay up to date:
git svn rebase
If you’ve cloned this repo (after posting it to GitHub or elsewhere) and want to use it on another computer, you’ll have to use do more step in order to track the original SVN repo again:
git update-ref refs/remotes/trunk origin/master
git svn init -T trunk http://code.yourmom.com/project/
Sources
- Brian Rosner’s Using git with Django Screencast
- Pieter on #github
- WebKit wiki (via Pieter)
Installing Git on OS X Leopard
It’s apparently best to install Git using both MacPorts and from source. That way you’ll get all the dependencies that are a pain in the ass to get set up, and you’ll also get the newest version of Git.
Install Git + Dependencies from MacPorts
Install the MacPorts “Leopard (Universal)” disk image from here.
If after the installation, running “which port” doesn’t show “/opt/local/bin/port“, try adding the following lines above any other path rules you have in your .bash_login file:
# MacPorts
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH
# / MacPorts
Make sure MacPorts is up-to-date:
sudo port -v selfupdate
Install Git:
sudo port install git-core
Install Git from Source
Go to git.or.cz and download the newest package.
Stick the file where you want it (I prefer /usr/local/src/).
Open the file and cd into its folder. Then:
sudo make prefix=/usr/local all
(You won’t need the sudo on the last command unless you’ve got your source in /usr/local/src/, which is owned by root)
Then:
sudo make prefix=/usr/local install
If everything goes as planned, you should be able to type “which git” and see exactly this:
/usr/local/bin/git
If instead you see /opt/local/… you’re using the MacPorts version and you need to move those path rules above the other rules in your .bash_login.
Enjoy.
Bonus: TextMate Integration
To use TextMate to edit your commit messages, put the following in your ~/.bash_login:
export GIT_EDITOR="mate -w"
Install the TextMate Bundle:
mkdir -p /Library/Application\ Support/TextMate/Bundles
cd !$
git clone git://gitorious.org/git-tmbundle/mainline.git Git.tmbundle
osascript -e 'tell app "TextMate" to reload bundles'
Since Git is installed in /usr/local/bin, you’ll need to make a link to where the bundle expects it:
sudo ln -s /usr/local/bin/git /usr/bin/git