DEV Community

Lev Eidelman Nagar
Lev Eidelman Nagar

Posted on

3 1

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

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay