Live data from Hacker News

How Core Git Developers Configure Git

blog.gitbutler.com

91–100 of 129 posts

Re: How Core Git Developers Configure Git

#91

I discovered that you can have git use the pager you like so I set it to my darling : bat git config --global core.pager bat https://github.com/sharkdp/bat/

Is there an advantage to doing this over setting the GIT_PAGER environment variable? (Weirdly, git doesn't seem to honour the PAGER var (which would be even better), although its man page claims it does)

Less env pollution.

Re: How Core Git Developers Configure Git

#92

I discovered that you can have git use the pager you like so I set it to my darling : bat git config --global core.pager bat https://github.com/sharkdp/bat/

Is there an advantage to doing this over setting the GIT_PAGER environment variable? (Weirdly, git doesn't seem to honour the PAGER var (which would be even better), although its man page claims it does)

I never used that env variable, but, an advantage is that you can put all your git configs in one file and reuse it across different machines, just like any dotfile.

If you use --local instead of --global, you can configure just for the current repository, useful if may find that delta is or isn't the best choice just for that repository

Re: How Core Git Developers Configure Git

#93
post #49
post #9

How much of this is for a noob like me that just uses vscode? I hardly ever see the git command line, and when I do see it, its trouble beyond what anybody can fix...

Setting merge conflictstyle diff3 or zdiff3 will improve your experience if you ever do any merging

I just use kdiff3 - automatically solves most merge conflicts & it’s rarely to never done so incorrectly. And when it can’t resolve the merge conflicts, line alignment is very nice. I prefer it to the cluttered experience of BeyondCompare and other more “feature-filled” options.

Re: How Core Git Developers Configure Git

#94
Happy to notice I already use most of these. The only ones I didn't know are diff.mnemonicPrefix, diff.renames and commit.verbose.

My config if you'd like to steal it, also here: https://github.com/silvanocerza/dotfiles/blob/master/git/git...

Mind that you need diff-so-fancy for this work correctly. https://github.com/so-fancy/diff-so-fancy

    [alias]
        co = checkout
        ci = commit
        cl = clone
        st = status
        f = fetch
        br = branch
        lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) %C(bold green)(%ar)%C(reset) %C(yellow)- %an%C(reset)%C(auto)%d%C(reset)%n"        "%C(white)%s%C(reset)' --all
        lgg = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
        type = cat-file -t
        dump = cat-file -p
        # Lists all local branches that have been deleted on remote
        gone = ! "git for-each-ref --format '%(refname:short) %(upstream:track)' | awk '$2 == \"[gone]\" {print $1}' | xargs git branch -D"
    
    [color]
        ui = true
    
    [push]
        default = simple
    
    [merge]
        tool = meld
        conflictStyle = zdiff3
    
    [diff]
        algorithm = histogram
        colorMoved = dimmed-zebra
        colorMovedWS = no
        mnemonicPrefix = true
        renames = true
    
    [rerere]
        enabled = true
    
    [pager]
        branch = false
    
    [core]
        pager = diff-so-fancy | less --tabs=4 -RFX
        fsmonitor = true
        untrackedCache = true
    
    [color "diff-highlight"]
        oldNormal = red bold
        oldHighlight = red bold 52
        newNormal = bold
        newHighlight = green bold 22
    
    [color "diff"]
        meta = yellow
        frag = magenta bold
        commit = yellow bold
        old = red bold
        new = green bold
        whitespace = red reverse
    
    [diff-so-fancy]
        markEmptyLines = false
    
    [filter "lfs"]
        clean = git-lfs clean -- %f
        smudge = git-lfs smudge -- %f
        process = git-lfs filter-process
        required = true
    
    [pull]
        rebase = false
    
    [init]
        defaultBranch = main
    
    [column]
        ui = auto
    
    [branch]
        sort = -committerdate
    
    [commit]
        verbose = true

Re: How Core Git Developers Configure Git

#95

Earlier quoted context omitted.

After using delta for a while, I'm going back to the regular diff view... it's not that it isn't good, but I'm constantly copying diffs (yes, I know I can generate patches) and the pretty output breaks that workflow. Also, when your terminal is a bit small it's a bit hard to see things. But it's really good software, I recommend anyone who's reading to give it a try.

Isn't copying without the formatting just a ` | pbcopy` away?

I have Gemini set to decipher HN comments that I don't immediately understand. This is a macos only command `pbcopy`?

Aside: Gemini mentioned it didn't want me to ask it questions about bikeshedding what shade of blue on a website header so I think it's got our number.

Re: How Core Git Developers Configure Git

#98
post #34

Earlier quoted context omitted.

Yeah, I didn't do aliases on purpose, because I wanted everything to be fairly global, where I feel like aliases are more personal. But yes, aliases are great.

as for me, I want something more. Like git shell. Where I no need to write git, git, git again and again. Strange that there is no something like this yet.

Dont the many git TUI clients (tig, lazygit, ...) work like that with keybindings?
Post reply on HN