[lang_en]Git porcelain has improved a lot, it still has a couple of rough spots. Here are a couple of git aliases that make my git workflow more pleasant:[/lang_en]
[lang_pt]A interface de linha de comando do git tem melhorado imenso, mas algumas operações poderiam ter melhor interface. Aqui seguem alguns aliases que tornaram o meu uso de git mais agradável:[/lang_pt]

  • [lang_en]Dealing with aliases[/lang_en][lang_pt]Para gerir aliases[/lang_pt]

    1
    2
    3
    4
    5
    git config --global --add alias.add-alias \
    '!f() { git config --global --add alias.$1 "$2"; }; f'
    git add-alias aliases 'config --get-regexp ^alias'
    git config --global --add alias.rm-alias \
    '!f() { git config --global --unset alias.$1 ;  }; f'

  • [lang_en]Basic shortcuts[/lang_en][lang_pt]Atalhos básicos[/lang_pt]

    1
    2
    3
    4
    5
    6
    7
    8
    9
    git add-alias stat status
    git add-alias co checkout
    git add-alias ci commit
    git add-alias br branch
    git add-alias fa 'fetch --all'
    git add-alias pullff 'pull --ff-only'
    git add-alias pullrb 'pull --rebase'
    git add-alias rbi 'rebase -i'
    git add-alias bi bisect

  • [lang_en]Informational[/lang_en][lang_pt]Atalhos informativos[/lang_pt]

    1
    2
    3
    4
    5
    6
    git add-alias root 'rev-parse --show-toplevel'
    git add-alias wb 'rev-parse --abbrev-ref HEAD'
    git add-alias desc 'describe --dirty --abbrev=40'
    git add-alias bll 'branch -vv --list'
    git add-alias where \
    '! echo "* HEAD:" $(git desc); git bll $(git wb)'

  • Branches

    1
    2
    3
    4
    git add-alias bup-om \
    'branch --set-upstream-to origin/master'
    git add-alias cob 'checkout -b'
    git add-alias cot 'checkout -b -t'

  • [lang_en]Fundamental settings[/lang_en][lang_pt]Opções essenciais[/lang_pt]

    1
    2
    3
    4
    5
    git config --global --add push.default simple
    git config --global --add core.ui true
    git config --global --add core.whitespace \
    trailing-space,space-before-tab,tab-in-indent
    git config --global --add merge.conflictstyle diff3

    [lang_en]Of course you must set user.email and user.name. If signing of commits is desired then set user.signingKey.[/lang_en]
    [lang_pt]Claro que é obrigatório configurar user.email e user.name. Quando se pretende assinar os commits então também tem que configurar user.signingKey.[/lang_pt]

Leave a Reply

You must be logged in to post a comment.