Live data from Hacker News

Git git git git git

caiustheory.com

31–40 of 244 posts

Re: Git git git git git

#31

>I quite often type git then go away and come back, then type a full git status after it. Does anyone else actually do this besides OP. I've never heard of this problem until now.

I do not. I thought the only reason that this was on the front page was because it was funny.

Re: Git git git git git

#32
It would be cool if you could generalize this for anything (e.g. ls ls -al). That being said, I wonder if there's any actual command-line utilities that actually use a similar syntax to perform something useful.

Re: Git git git git git

#33

Why type out `git status`? I use `gst`, and lots of other great aliases provided by the [oh-my-zsh git plugin]( https://github.com/robbyrussell/oh-my-zsh/blob/master/plugin... )

Somewhat related, from my .bashrc for a in $(git var -l | sed -nE 's/^alias\.([^=]*)=.*/\1/p') ; do if ! command -v g$a >/dev/null 2>&1 ; then alias g$a="git $a" fi done Which creates a shell alias prefixed with `g` for each of my configured git aliases if there is no conflict. So I get not only the `gst` command you mentioned and ones like `gco` (because I have Subversion-equivalent aliases for common commands), but…

great thx

Re: Git git git git git

#34

>I quite often type git then go away and come back, then type a full git status after it. Does anyone else actually do this besides OP. I've never heard of this problem until now.

It's usually more "type git in a terminal then open a new tab to look something up and ALT-TAB back to the terminal" rather than a physical going away.

Re: Git git git git git

#35

>I quite often type git then go away and come back, then type a full git status after it. Does anyone else actually do this besides OP. I've never heard of this problem until now.

I often type "git clone ", then switch to a browser to copy/paste the URL, which is usually fine, but there are still many times where I've happened to include "git clone" in the copied string. (So I end up with "git clone git clone $URL").

Re: Git git git git git

#36
`!exec git` caused my shell to exit. I have a lot of stuff wrapping git in my shell though (including a bash function wrapping git itself!). The author himself only pushed up the change to his own gitconfig a few hours ago. It was previously `!$SHELL -c \"git $*\"`.

My version that works for my setup is `"!f() { git \"$@\"; }; f"`.

Hope this helps anyone who ran into the same issue, although I'm not 100% confident about the quoting.

EDIT: fixed the quoting, as per cryptonector's suggestion

EDIT2: need to quote the quotes for gitconfig to use it correctly

Re: Git git git git git

#37

>I quite often type git then go away and come back, then type a full git status after it. Does anyone else actually do this besides OP. I've never heard of this problem until now.

> Does anyone else actually do this besides OP.

Guilty as charged. I'll commonly start typing git, think about something else, switch to my editor, browser or an other terminal tab, then come back and type "git " in full.

Unsurprisingly…

    > rg 'git =' ~/.gitconfig 
    7:	git = ! git

Re: Git git git git git

#39

The mathematical term for a function that is the same when applied multiple times giving you the same results is called "idempotent" which translates to "same power". f^n(x)=f(x) for some positive natural number n and any x. https://en.wikipedia.org/wiki/Idempotence

I had a senior dev interview with a major company in SV last year where the lead and hiring manager claimed that the description for this behavior was "side-effect free". I didn't want to ruin my chances by correcting him that side-effects and idempotence refer to different qualities. I passed the interview, but I've never forgotten that. The guy also seemed to have washed into the interview off his surf board. Oh we…

In the context of software it seems like the word has pretty broadly adopted the meaning of "side-effect free". It's even made it to Wikipedia: https://en.wikipedia.org/wiki/Idempotence#Computer_science_m...

One notable example: Stripe's "idempotency keys": https://stripe.com/blog/idempotency

Post reply on HN