Saltycrane logo

SaltyCrane Blog

Notes on Python, Django, and web development on Ubuntu Linux

     Posts tagged "git"

Example using git bisect to narrow in on a commit

I learned about git bisect from this Stack Overflow poll: What are your favorite git features or tricks? I thought it was so cool that I wanted to share an example.

After upgrading from Django 1.2.3 to Django 1.3, something broke on the website I was working on. To figure out what was wrong, I used git bisect to find the Django revision that introduced the relevant change. I cloned the Django github repo and pip install -e'd it into my virtualenv. Then I used git bisect as follows:

  • Start git bisect
    $ git bisect start 
    
    $ git ...
... read more »

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

From http://stackoverflow.com/questions/1841341/remove-local-tags-that-are-no-longer-on-the-remote-repository/5373319#5373319

$ 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 ...
... read more »

Colorized, interactive "git blame" in Emacs: vc-annotate

A few months ago, I learned that vc-annotate displays a nicely colorized git blame in Emacs. Today I learned that it is also interactive. I can cycle through revisions using p and n, open the file at a specified revision with f, view the log with l, and show a diff with d or changeset diff with D. (Unfortunately, the diff is ugly and not in color.)

vc-annotate is included with Emacs. To use, open a version controlled file, and type C-x v g or M-x vc-annotate

I am using Emacs 23.1 on Ubuntu Maverick

... read more »

Versioning /etc with etckeeper and git

Update 2011-08-13: I switched to a custom apt-get wrapper so that I can keep a versioned list of installed packages and generally because I have NIH. (I had no problems with etckeeper). My apt-get wrapper is on here on github

  • $ sudo apt-get install etckeeper 
    
  • Edit /etc/etckeeper/etckeeper.conf. Change VCS from "bzr" to "git"
  • Initialize etckeeper and git repo
    $ cd /etc
    $ sudo etckeeper init 
    $ sudo git status 
    $ sudo git commit -m 'Initial commit' 
    
  • Done.
... read more »

My software tools list

Inspired by Mark Pilgrim's 2006 Essentials list, below is a list of my current software tools. If you notice a lot of "I switched from ..." statements, keep in mind that I am a programmer who likes shiny things.

Other lists

... read more »
Created with Django | Hosted by Linode