Live data from Hacker News

ToolGit: A collection of scripts that extend Git with various sub-commands

github.com

51–59 of 59 posts

Re: ToolGit: A collection of scripts that extend Git with various sub-commands

#52
post #14

These should be aliases in your git config. git config --global alias. 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 affirmati…

You’re suggesting not to use a functionality built into got from early days that naming a script git-something and putting it on your PATH gives you a sub command of “git something”.

Why do you disagree with this early decision from git?

Re: ToolGit: A collection of scripts that extend Git with various sub-commands

#53
post #35
post #24

Earlier quoted context omitted.

What would the alias command be for 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.

Thanks for keeping me honest. I just read the first line of the stackoverflow, but the one liner is still in the comments. I just tested it. https://stackoverflow.com/questions/7726949/remove-tracking-... git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d

That looks fine and will generally work, except when the current branch is one of the ones to be deleted.

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

Re: ToolGit: A collection of scripts that extend Git with various sub-commands

#54
post #14

These should be aliases in your git config. git config --global alias. 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 affirmati…

Came here to say this.

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.

Re: ToolGit: A collection of scripts that extend Git with various sub-commands

#55
post #53
post #35

Earlier quoted context omitted.

Thanks for keeping me honest. I just read the first line of the stackoverflow, but the one liner is still in the comments. I just tested it. https://stackoverflow.com/questions/7726949/remove-tracking-... git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d

That looks fine and will generally work, except when the current branch is one of the ones to be deleted. The 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.

I'm going to assume you have about as many years of experience as me based on your profile, but if you're going to argue that maintaining this script - for the sole convenience of deleting a branch out from underneath you - is worth it, then there's nothing more I can do to help you.

Re: ToolGit: A collection of scripts that extend Git with various sub-commands

#56
Speaking of "subcommands" that add some features, I recently built a tool to provide a better experience for splitting a commit into multiple commits than doing a soft reset and using `git add -p`: https://github.com/Artamus/git-split/.

Maybe someone will find it useful :).

Re: ToolGit: A collection of scripts that extend Git with various sub-commands

#57
post #55
post #53

Earlier quoted context omitted.

That looks fine and will generally work, except when the current branch is one of the ones to be deleted. The 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.

I'm going to assume you have about as many years of experience as me based on your profile, but if you're going to argue that maintaining this script - for the sole convenience of deleting a branch out from underneath you - is worth it, then there's nothing more I can do to help you.

You're being really dismissive. Handling bad inputs and edge cases, and including help texts, is the sort of requirement that necessitates moving away from one-liners towards a more structured repository.

Re: ToolGit: A collection of scripts that extend Git with various sub-commands

#58
post #8

This needs a “git-track”. Make the current branch track the one in origin with the same name, if it exists

In oh-my-zsh you have `ggsup` which is an alias for `git branch --set-upstream-to=origin/$(git_current_branch)`. `git_current_branch` is also a function that is bundled with oh my zsh.

Thanks. I found a way to do it with just git. No oh-my-zsh necessary:

git config --global alias.track '!git branch -u origin/$(git branch --show-current)'

Re: ToolGit: A collection of scripts that extend Git with various sub-commands

#59

https://gist.github.com/romainl/a3ddb1d08764b93183260f8cdf0f... This script in your path means that after you say pull code and have merge conflicts, "git jump" will open vim with the quickfix list populated with the locations of the conflicts.

Jump is distributed under /usr/share/git-core/contrib or something.

Aah, nice! I read that note about it being in contrib. Never bothered to find out whether contrib is distributed with the built git package or not.
Post reply on HN