Live data from Hacker News

Show HN: Switch Git Users CLI

github.com

31–40 of 61 posts

Re: Show HN: Switch Git Users CLI

#31
post #4

git has a similar feature built in: https://deepsource.io/blog/managing-different-git-profiles/

!!! which not only covers the identity scenario but the whole configuration of git, which can be indeed very different from repo to repo, from company to company

Re: Show HN: Switch Git Users CLI

#32
post #19
post #13

I 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.

I do the same. Also remember the following keyword if you use nested .envrc files: source_up

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

#35
post #26

Earlier 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.

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

#36

What'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...)

I think one of the benefit of using js to write cli tool is that you can install them very easily on Windows.

Re: Show HN: Switch Git Users CLI

#37
post #35

Earlier 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.

> 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

Re: Show HN: Switch Git Users CLI

#38
post #35

Earlier 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.

Well no. I don't need multiple versions of the same library to do this, neither do i need the cache engine of some v8 browser either.

Re: Show HN: Switch Git Users CLI

#39
post #37
post #35

Earlier 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

fzf is not a standard tool.
Post reply on HN