Sarav's Weblog

Technical Articles for RoR Developers

Category Archives: Git

Remove a remote Git branch and tags

Removing a branch from your remote repo is a little bit different from removing it locally. It’s all about the colon:


git push origin :heads/some-branch
git push origin :your_branch_name

removes some-branch from the remote repo (apparently git push origin :some-branch works as well).

This works for removing a tag as well:

git push origin :sometag

I found it in the git guides posting it here for *my* reference, and possibly other people as well.



Do a “git export” like “svn export”

git export
Probably the simplest way to achieve this is with git archive. If you really need just the expanded tree you can do something like this.

git archive master | tar -x -C /your/path/to/export

Most of the time that I need to ‘export’ something from git, I want a compressed archive in any case so I do something like this.

git archive master | bzip2 >source-tree.tar.bz2

git help archive for more details, it’s quite flexible.