Live data from Hacker News

How Core Git Developers Configure Git

blog.gitbutler.com

111–120 of 129 posts

Re: How Core Git Developers Configure Git

#111

Earlier quoted context omitted.

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?

yes, but I prefer writing status, stash, checkout, commit hand by) So, the more I think about my previous comment the less sense I see in such feature :)

Re: How Core Git Developers Configure Git

#112
post #80

My favorite alias is `git out`, which just lists all unpushed commits. I use it all the time. [alias] out = "log @{u}.." In my head I always hear it in the voice of The Terminator: https://youtu.be/8cdC1Y5oRFg?t=54

That comes out of the box with Mercurial. (`hg out` or `hg outgoing`).

Re: How Core Git Developers Configure Git

#113
post #88

Earlier quoted context omitted.

I should do another article on the best aliases, because this is a great one. I want it just because I want to do the Arnold voice every time. Now I want to do: `git to-da-choppa`

That could be just git add . && git commit -a -m "git to da choppa" && git push --force For when you need to Get to da choppa and don't have time to clean up =)

I use `qp`for `quick-push` with a function to provide a comment:

  # git alias
  qp = "!f() { git add . && git commit -m \"$1\" && git push; }; f"


  # usage
  git qp "whatever your comment is"

Re: How Core Git Developers Configure Git

#114
I wonder why commit signing is not part of these configs... it is pretty easy to do with a modern ssh key:

  [user]
    name = xyz
    email = xyz@domain.com
    signingkey = ~/.ssh/id_algorithm.pub
  
  [commit]
    gpgsign = true
  [tag]
    gpgsign = true

  [gpg]
    format = ssh

  # restrict allowed signers
  # echo "$(git config --get user.email) namespaces=\"git\" $(cat ~/.ssh/id_*.pub)" >> ~/.git_allowed_signers
  [gpg "ssh"]
    allowedSignersFile = ~/git_allowed_signers  

On github you can add the ssh key for authentication but also for signing. Unfortunately you have to add the key twice but once you've done it, you get rid of the `unverified` label within a commit.

Re: How Core Git Developers Configure Git

#115

Earlier quoted context omitted.

It's very common for shared project-specific setting files to be stored in ".vscode" that are used by all developers on the project, including launch/task configurations. VSCode settings are hierarchical and composable (non-scalar keys are merged).

I am aware of that. Yet I don't see other cohorts doing that with their editor/IDE of choice. It seems to be mostly the "I don't want to configure my tools" subset, who does that. What if I switch my tool of choice 2-3 times? Do I get to commit all my project management IDE/editor specific files too? How much stuff do we want to accumulate in the git repo?

> Do I get to commit all my project management IDE/editor specific files too

Yes, if those files apply to all team members using the same tool absolutely check them in. What's the problem? It reads to me like maybe you don't know what these files are actually used for and why a team benefits from sharing them.

Re: How Core Git Developers Configure Git

#116
post #27

My own ~/.gitconfig looks like this: [alias] co = checkout ci = commit st = status br = branch hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short type = cat-file -t dump = cat-file -p dft = difftool [tag] sort = version:refname [tar "tar.xz"] command = xz -c [tar "tar.zst"] command = zstd -T0 -c [log] date = iso-local [pull] ff = only [diff] tool = difftastic [safe] directory = * [advice] detachedH…

Do your aliases even save you any keystrokes? Most shells support auto complete, and you still have to type "git" unless you have a shell alias for it.

I guess what I'm git-ing at is a truly efficient alias would be embedded in the shell. For a while I had "gsno = git status --uno" although it's been so long since I used it, I forget what the options even did. Somehow I get by with only stock commands.

Another helpful alias I used to use was ctrl-space, I had aliased for 'make'. Somehow I liked it because you can almost gesture it with slamming both hands down simultaneously.

Re: How Core Git Developers Configure Git

#117

Earlier quoted context omitted.

That could be just git add . && git commit -a -m "git to da choppa" && git push --force For when you need to Get to da choppa and don't have time to clean up =)

I use `qp`for `quick-push` with a function to provide a comment: # git alias qp = "!f() { git add . && git commit -m \"$1\" && git push; }; f" # usage git qp "whatever your comment is"

I almost never want to do `git add .`. I find `git add -u` to be better; it only stages known files.

Re: How Core Git Developers Configure Git

#118

Earlier quoted context omitted.

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.

Though, if you have a preferred shade of blue, you can actually use it for the HN header in your user settings.

Re: How Core Git Developers Configure Git

#119

Earlier quoted context omitted.

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.

Yes pbcopy is a mac thing. On Linux, there are of course many different commands in different environments/distros. xsel, xclip, wl-clipboard, wlclip to name a few. On windows, powershell has Get-Clipboard and Set-Clipboard, and cmd.exe has `wsl` to fix the issue of having used cmd.exe to begin with.

On Linux I made a ~/bin/pbcopy that does the right thing because all the Linux commands are stupidly difficult to remember compared to "pbcopy".

Re: How Core Git Developers Configure Git

#120
I think this should be the default:

    git push --force-with-lease
Forces pushes are dangerous enough as it is, so I'm mystified on why git doesn't insist you know the state of upstream before running it.

Sadly you can't make it the default, so I resort to:

    [alias]
        force-push = push --force-with-lease
As for the article, I must the the weird one because I prefer most of the settings are they are or don't care. Even some of those designated as "clearly better" don't look to me.
Post reply on HN