Chivil blog

Aller au contenu | Aller au menu | Aller à la recherche

mai, 28 2010

git svn update automated

To allow git-svn users to do the equivalent of a svn up in one command, instead of saving local changes to the stash before rebasing (then dropping the stash)

Warning keep in mind that this will discard the current index

In your ~/.gitconfig file:

[alias]
    svnup = !DIRTY=$(git status --porcelain -uno) && \
        git stash save svn-up-auto && git svn rebase && \
        test -n \"$DIRTY\" && git stash pop

    svncommit = !DIRTY=$(git status --porcelain -uno) && \
        git stash save svn-up-auto && git svn dcommit && \
        test -n \"$DIRTY\" && git stash pop

décembre, 09 2009

Git: find commit pointing to specific file

Just posting here a solution to a problem I had and could not find easily.

The problem was .. how do I find which commit contained a specific version of a file?

With the file at hand, I could simply use git-hash-object to have its hash

git-hash-object file.pl

afb2de5691078405dde84b3c1ba07ae3611f5396

Easy enough. The real problem was : how do I find references to this hash?

The only command I found to do that is git whatchanged

git whatchanged

commit 8296847023cf52d9273f59e93da1f18fa1313004
Author: TrucMuche <muche@54c5169c-8210-0410-b4c6-88e7fb53b929>
Date:   Fri Nov 27 13:49:37 2009 +0000

    some stuff

Then just search for the short version of the hash (afb2de5):

commit 8d7e23f9589a2858afd7b4f0f5f8f26c8c440541
Author: TrucMuche <muche@54c5169c-8210-0410-b4c6-88e7fb53b929>
Date:   Mon Nov 16 15:26:57 2009 +0000

    some more stuff

:100644 100644 426edf6... afb2de5... M  path/to/file.pl

If anyone knows a better way let me know :-)