Background

When we renamed our github organization the entire (rather large) team had to manually update the remote URLs which proved to be a daunting task. I created git-url-sub to make this easier.

Install using Homebrew on OS X:

brew install git-url-sub

Install from source:

git clone git://github.com/gosuri/git-url-sub.git
cd git-url-sub
sudo make install

Usage:

git url-sub [options] pattern replacement

Example

To replace first occurrences of foo in the remote url with bar

$ git url-sub foo bar # will dry run

. origin (fetch) git@github.com:foo/project.git -> git@github.com:bar/project.git
. origin (push)  git@github.com:foo/project.git -> git@github.com:bar/project.git

NOTE: No changes have been made. Please run with -c flag to commit changes

$ git url-sub -c foo bar # commit once you are satisfied with changes

. origin (fetch) git@github.com:foo/project.git -> git@github.com:bar/project.git
. origin (push)  git@github.com:foo/project.git -> git@github.com:bar/project.git

Changes have been made to the above urls

Like it? You can Tweet about it or (and) follow me on Twitter for updates.