const store = require("data-store")({ path: process.cwd() + "/data.json" });
I think a `git-user-data.json` file in a centralized location makes far more sense.Show HN: Switch Git Users CLI
21–30 of 61 posts
Re: Show HN: Switch Git Users CLI
#22Re: Show HN: Switch Git Users CLI
#23A 1000 line YARN lock file for something that would be roughly 20 lines of bash is amazing and terrifying at the same time.
various permutations of which were posted an hour ago and are currently higher than this comment, so I’m confused why multiple people asked to see them ~30½ minutes ago
Re: Show HN: Switch Git Users CLI
#24I 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…
Re: Show HN: Switch Git Users CLI
#25Re: Show HN: Switch Git Users CLI
#26A 1000 line YARN lock file for something that would be roughly 20 lines of bash is amazing and terrifying at the same time.
> roughly 20 lines of bash various permutations of which were posted an hour ago and are currently higher than this comment, so I’m confused why multiple people asked to see them ~30½ minutes ago
Re: Show HN: Switch Git Users CLI
#27I 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…
$ git whoami
GIT_COMMITTER_IDENT=Mel Smith
GIT_AUTHOR_IDENT=Mel Smith
`whoami` can be implemented via a simple alias: git config --global alias.whoami = "! git var -l | grep '^GIT_.*_IDENT'"Re: Show HN: Switch Git Users CLI
#28What'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 suspect it was written in JS because that was the author’s language of choice. There are lots of ways to manage git identities and this seems like a decent utility for web devs who already have node installed and don’t care to manually edit config files.
Re: Show HN: Switch Git Users CLI
#29This is a great looking tool. What I have been doing by hand for some time is putting code for different customers in different directories and having a conditional in `~/.gitconfig` to determine what config applies there: [includeIf "gitdir:~/projects-private/**"] path = ./.gitconfig-private [includeIf "gitdir:~/projects-client/**"] path = ./.gitconfig-work Then in .gitconfig-private or .gitconfig-work I have all th…
Re: Show HN: Switch Git Users CLI
#30Earlier quoted context omitted.
> roughly 20 lines of bash various permutations of which were posted an hour ago and are currently higher than this comment, so I’m confused why multiple people asked to see them ~30½ minutes ago
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.