by henshao · 2y ago · 0 comments
git config --global alias.<cmd> <cmd>
I'm really trying to understand, and not to be too negative. I get coming up with a solution to a problem, and finding it neat locally. But before posting to HN, one might realize that these solutions that git provides existing tools for is better than maintaining this.I'm also confused by all the comments just blindly commenting in the affirmative or providing suggestions. Are we all bots?
One might. But not everybody knows about those existing tools. Taking myself as an example: I've been using Git since nearly the time it was released and I had no idea that git had aliasing built in. Sometimes things just never come up and people don't find out about them. shrug
I think a way to do this is to not let git track that in the first place, with some variation of:
git config core.fileMode false
via: https://stackoverflow.com/questions/1580596/how-do-i-make-gi...or
https://stackoverflow.com/questions/2517339/how-to-restore-t...
git-delete-gone-branches
?EDIT: I saw your other comment (incorrectly) claiming that git remote prune origin will do the job. I don't know of any git trickery that can do the job. And believe me I'd love it if there was something.
https://stackoverflow.com/questions/7726949/remove-tracking-...
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -dThe script in OP handles that edge case by switching to the main branch before deleting. That may or may not be intuitive but I think it's a reasonable response. The script also prints error messages for various other bad inputs. Once you strip all that out it's only a few lines long.
Compare this with another tool that lets people extend its own command, cargo. You can do cargo install <something> and then run cargo <something>.
No, I have never used NPM directly. Why do you ask?
Maybe we are 10x engineers w.r.t. git aliases. Congratulations
I should get "10x engineer with my git aliases" put onto a t-shirt :)
Why do you disagree with this early decision from git?
I looked at 1/3 of the scripts and not one _adds_ functionality, they only add interfaces for existing functionality.
I hate to say this but I feel like this post got upvoted simply for being hit-adjacent.
I wonder if voting on the front page is a bad setup.