git

My git config

eidellev

Lev Eidelman Nagar

Posted on February 20, 2020

My git config

This is my current git config. I'm mostly publishing this for the aliases, that I hope some will find useful.
I addition, I'm using the excellent git-interactive-rebase-tool and diff-so-fancy for easily squashing past commits and better looking diffs respectively.

  [user]
    name = USERNAME
    email = EMAIL

  [push]
    default = simple
    followTags = true

  [core]
    editor = nvim
    autocrlf = false
    safecrlf = false

  [alias]
    visual = !gitk
    # Get the current branch name (not so useful in itself, but used in other aliases)
    branch-name = !git rev-parse --abbrev-ref HEAD
    co = checkout
    # Create a new branch
    cob = "checkout -b"
    c = cherry-pick
    cl = clone
    st = status -sb
    br = branch
    # Delete local branch
    brd = "branch -D"
    # Pretty log
    h = log --pretty=format:\"%C(auto)%h %ad (%cr) %s%d [%Cgreen %an %Creset]\" --graph --date=short --all
    p = push
    # Push the current branch to the remote "origin", and set it to track the upstream branch
    pub="!git push -u origin $(git branch-name)"
    # Delete remote branch
    pd = "push --delete origin"
    cm = commit
    cmm = commit -m
    # Amend to last commit
    cma = commit --amend
    # Make a quick commit with WIP(work in progress) message
    wip = !git add --all && git commit -m "WIP"
    # Make a quick commit with WIP(work in progress) message and skip validations
    wipnv = !git add --all && git commit -m "WIP" --no-verify
    # Pull latest changes and sync current branch with remote
    sync = !git fetch --prune && git pull
    # Finds the commit where file was added. Usage: `git whatadded tsconfig.json`
    whatadded = log --diff-filter=A

  [pager]
    diff = diff-so-fancy.cmd | less --tabs=4 -RFX
    show = diff-so-fancy.cmd | less --tabs=4 -RFX

  [pack]
    windowMemory = 100m
    packSizeLimit = 100m


  [color]
    ui = true

  [color "diff-highlight"]
    oldNormal = red bold
    oldHighlight = red bold 52
    newNormal = green bold
    newHighlight = green bold 22

  [color "diff"]
    meta = yellow
    frag = magenta bold
    commit = yellow bold
    old = red bold
    new = green bold
    whitespace = red reverse

  [credential]
    helper = manager


  [sequence]
    editor = interactive-rebase-tool

Enter fullscreen mode Exit fullscreen mode
πŸ’– πŸ’ͺ πŸ™… 🚩
eidellev
Lev Eidelman Nagar

Posted on February 20, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related