git has a similar feature built in: https://deepsource.io/blog/managing-different-git-profiles/
Show HN: Switch Git Users CLI
31–40 of 61 posts
Re: Show HN: Switch Git Users CLI
#32I found this user management strategy somewhere, and it's been working great for me: git config --global --unset user.name git config --global --unset user.email git config --global --unset user.signingkey git config --global user.useConfigOnly true git config --global user. .name " " git config --global user. .email " " git config --global alias.identity '! git config user.name "$(git config user.$1.name)"; git conf…
I find it much easier to use direnv and set GIT_AUTHOR_EMAIL in each of ~/work/.envrc and ~/personal/.envrc No need to reconfigure every repo this way.
If you don't use this in any nested envrc files, the settings don't carry over which means your git settings are not maintained. It is kind of an escape hatch as the parent files are not verified in the same way normal envrc files are, but I have found the trade off to be worth it
Re: Show HN: Switch Git Users CLI
#33A 1000 line YARN lock file for something that would be roughly 20 lines of bash is amazing and terrifying at the same time.
Re: Show HN: Switch Git Users CLI
#34Re: Show HN: Switch Git Users CLI
#35Earlier quoted context omitted.
I asked because none of the posted permutations offer the same feature set. Specifically, the nice thing about this utility (and reason for the dependencies) is interactive adding and selecting of identities. If this can replicated in bash, I am legitimately interested in seeing it, 20 lines or not.
Implement the `git identity` portion listed earlier with a `identity-list` utilizing `git config --get-regexp`. If you need interactivity you can tie it together with fzf and some awk.
Re: Show HN: Switch Git Users CLI
#36What's the point of writing this simple tool in js? I'd like to use it but I don't have npm everywhere (and I don't want to grab a huge tree of dependencies just for editing a couple of lines on a text file...)
Re: Show HN: Switch Git Users CLI
#37Earlier quoted context omitted.
Implement the `git identity` portion listed earlier with a `identity-list` utilizing `git config --get-regexp`. If you need interactivity you can tie it together with fzf and some awk.
So, not a 20 line bash script and at least two big dependencies. Sounds a lot like what you were poking fun at.
Awk (a fraction of busybox’s 2.1 MBs) is a “big dependency”‽ Or maybe you’re saying git is‽
Edit: quote
Re: Show HN: Switch Git Users CLI
#38Earlier quoted context omitted.
Implement the `git identity` portion listed earlier with a `identity-list` utilizing `git config --get-regexp`. If you need interactivity you can tie it together with fzf and some awk.
So, not a 20 line bash script and at least two big dependencies. Sounds a lot like what you were poking fun at.
Re: Show HN: Switch Git Users CLI
#39Earlier quoted context omitted.
So, not a 20 line bash script and at least two big dependencies. Sounds a lot like what you were poking fun at.
> at least two big dependencies Awk (a fraction of busybox’s 2.1 MBs) is a “big dependency”‽ Or maybe you’re saying git is‽ Edit: quote