Readit News logoReadit News
disintegrator · a year ago
One git life hack I adopted is to sign my commits with an SSH key that is stored in 1Password. Anytime a tool like git or vs code (with git under the hood) wants to sign commits, fetch/pull/push a remote, or clone a repo I get a nice pop up from 1P which prompts for TouchID on my macbook. My SSH keys don't not live on my machine as a result. This also works with SSH agent forwarding if you develop inside a VM or remote machine.
elroyjetson · a year ago
For the benefit of others that read this and like the idea, here are instructions: https://developer.1password.com/docs/ssh/git-commit-signing/
bdjsiqoocwk · a year ago
Trusting your keys to someone else is already a terrible idea. Anything increasing the importance of those keys is doubling down. Please keep these ideas to yourself.
urda · a year ago
It would be amazing if 1Password extended that to GPG. I opened a support ticket with them earlier this year for it as well.
ajyey · a year ago
I recently just started doing this as well. I love it
wizerno · a year ago
Julia Evans blog post [1] on the same topic, contains some more useful options.

[1] https://jvns.ca/blog/2024/02/16/popular-git-config-options/

joshka · a year ago
I'm generally addicted to the oh-my-zsh git plugin aliases[1]. Mostly gswm (git switch main), gswc (git switch --create), gpf (git push --force-with-lease), gcam (git commit all --message), gcan! (git commit all --amend --no-edit), grbm (git rebase main), grbc (git rebase --continue), grba (git rebase --abort)

gwip (git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]") is kinda useful when I want an actual commit before I change branches to do something else (I use this more often than stashing.

I also am a fan of git-brv from git extras (list branches verbose sorted by date - with the option to sort reverse so the last modified branch is the last one on your terminal)

And also git-trim - clean up merged branches

[1]: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git

dennis-tra · a year ago
I’d like to add

  please = push —-force-with-lease
for rebase-heavy workflows

ribasushi · a year ago
Cool stuff, thanks for sharing. I strongly recommend you add `rerere.enabled true` (makes `git pull --rebase` life easier)
KiranRao0 · a year ago
Cool, I haven’t seen that one before!
suralind · a year ago
Really cool, here's mine [0] that's slightly longer. I also have a bunch of other stuff that you may like.

I also have a few handy aliases for commands I never remember [1]. Don't need to have shortcuts like `git co` and others, because I use CMD + R with fzf to find what I need.

[0]: https://github.com/artuross/dotfiles/blob/main/home/dot_conf...

[1]: https://github.com/artuross/dotfiles/blob/main/home/dot_conf...

Deleted Comment

pajko · a year ago
Should have a setting for autocrlf and safecrlf to avoid shooting yourself in the foot while copying the config between platforms.
GauntletWizard · a year ago
There's a bug in here: some git git commands will fail if you are in a subdirectory; i.e. git git add foo, because the behavior of ! Is to run those from the git root. My solution is:

  git = !cd -- ${GIT_PREFIX:-.} && git