[SR-Dev] usefull git options

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Nov 20 02:56:34 CET 2008


Include one line summaries of the merged commits in commit merge messages 
(a MUST):
git config --global merge.log true

Use auto-tracking (behave as if -track is added to every git-pull):

git config --global branch.autosetupmerge always


Note: --global changes the global configuration ( ~/.gitconfig). Without 
 --global the local per repository configuration will be changed
 (.git/config). You can either use the commands above or edit by hand
 the config files.


Example ~/.gitconfig:
[user]
        name = Andrei Pelinescu-Onciul
        email = andrei at iptel.org
        signinkey = 2CF56A2D
[color]
        branch = auto
        status = auto
[merge]
        log = true
[branch]
        autosetupmerge = always
[remote "ser"]
        url= ssh://git.sip-router.org/ser
        push=cvshead:andrei/cvshead
        push=sctp:andrei/sctp
[url "ssh://git.sip-router.org/"]
        insteadOf = sip-router:
        insteadOf = sip_router:
[alias]
        intercommit = !sh -c 'git show "$0" > /tmp/commit1 && git show "$1" > /tmp/commit2 && interdiff /tmp/commit[12] | less -FRS'
        funcdiff = !sh -c \"git show \\\"\\$0:\\$2\\\" | sed -n \\\"/^[^ \\t].*\\$3(/,/^}/p\\\" > /tmp/.tmp1 &&\n git show \\\"\\$1:\\$2\\\" | sed -n \\\"/^[^ \\t].*\\$3(/,/^}/p\\\" > /tmp/.tmp2 &&\ngit diff /tmp/.tmp1 /tmp/.tmp2\"


The insteadOf lines create aliases for the url (so that I can use
 git pull sip-router:ser_core cvs-head  instead of
 git pull ssh://git.sip-router.org/ser_core cvs-head

The aliases create a new git "commands", for more details see
http://git.or.cz/gitwiki/Aliases.

The funcdiff alias tries to display the differences in _one_ function
 between 2 different commits, e.g.: 
git funcdiff <oldrev> <newrev> <path> <function>

The intecommit alias is for seeing differences between a submited patch 
(local commit into your repository) and the possibly modified version
applied: git intercommit <orig_commit> <applied_commit>.


Andrei



More information about the sr-dev mailing list