git notes
How to get the tag associated with a specific git revision
$ git describe --tags 5c70d1a15a4637a2057b1464c54820629e78cd05
staging/1.5
How to show the tracked branches from the remote "origin"
$ git remote show origin
How to find renames¶
$ git log --name-only --follow --all -- filename
How to remove all local tags¶
$ git tag -l | xargs git tag -d
How to detach a subdirectory into separate Git repository¶
Note I did not want any tags or branches in the new repository. From http://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository/359759#359759
$ git clone --no-hardlinks /XYZ /ABC
$ cd /ABC
$ git remote rm origin
$ git tag -l | xargs git tag -d
$ git filter-branch --subdirectory-filter ABC HEAD
$ git reset --hard
$ rm -rf .git/refs/original/
$ git reflog expire --expire=now --all
$ git gc --aggressive --prune=now
How to convert a Mercurial repo to git¶
$ git clone git://repo.or.cz/fast-export.git
$ mkdir new_git_repo
$ cd new_git_repo
$ git init
$ /path/to/hg-fast-export.sh -r /path/to/hg_repo
$ git checkout HEAD
Related posts
- Example using git bisect to narrow in on a commit — posted 2011-08-13
- Colorized, interactive "git blame" in Emacs: vc-annotate — posted 2011-05-28
- Versioning /etc with etckeeper and git — posted 2011-04-24
- My software tools list — posted 2007-08-10
Post a comment
About
I'm Eliot and this is my notepad for programming topics such as Python, Django, Ubuntu, Emacs, etc... more »
Search Blog
Tags
-
algorithms
(6)
-
aws
(10)
-
blogproject
(20)
-
c_cplusplus
(12)
-
cardstore
(8)
-
colinux
(2)
-
concurrency
(13)
-
conkeror
(2)
-
core
(2)
-
cygwin
(17)
-
datastructures
(14)
-
datetime
(4)
-
decorators
(4)
-
django
(40)
-
emacs
(22)
-
files_directories
(12)
-
git
(5)
-
hardware
(5)
-
install_setup
(8)
-
javascript
(3)
-
keyboard
(9)
-
matplotlib
(6)
-
mercurial
(4)
-
nginx
(2)
-
persistence
(6)
-
preferences
(7)
-
processes
(4)
-
pyqt
(18)
-
python
(146)
-
ratpoison
(3)
-
regexes
(6)
-
rsync
(3)
-
softwaretools
(17)
-
sql
(14)
-
ssh
(10)
-
subversion
(6)
-
twisted
(7)
-
ubuntu
(65)
-
urxvt
(5)
-
vxworks
(25)
-
webdev
(6)
-
wmii
(7)
Blogroll
- Adam Gomaa
- Alex Clemesha
- Amir Salihefendic
- Armin Ronacher
- David Beazley
- David Ziegler
- Duncan McGreggor
- Gareth Rushgrave
- Glyph Lefkowitz
- Guido van Rossum
- Ian Bicking
- Jacob Kaplan-Moss
- James Bennett
- James Tauber
- Jesper Noehr
- Marty Alchin
- Matt Harrison
- Nikolay Kolev
- Parand Darugar
- Peter Baumgartner
- Peter Bengtsson
- Rob Hudson
- Simon Willison
- Will McGugan