TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Git git git git git

510 pointsby caiusdurlingover 7 years ago

50 comments

gulperxcxover 7 years ago
&gt;I quite often type git then go away and come back, then type a full git status after it.<p>Does anyone else actually do this besides OP. I&#x27;ve never heard of this problem until now.
评论 #15341976 未加载
评论 #15342052 未加载
评论 #15342409 未加载
评论 #15342356 未加载
评论 #15342065 未加载
评论 #15342531 未加载
评论 #15342378 未加载
评论 #15341905 未加载
评论 #15342042 未加载
评论 #15341995 未加载
评论 #15342266 未加载
评论 #15344010 未加载
评论 #15346595 未加载
评论 #15342284 未加载
评论 #15341903 未加载
评论 #15342263 未加载
评论 #15341951 未加载
评论 #15343887 未加载
评论 #15342367 未加载
评论 #15346964 未加载
评论 #15342554 未加载
评论 #15341883 未加载
评论 #15342587 未加载
评论 #15346038 未加载
评论 #15342007 未加载
评论 #15341998 未加载
评论 #15341988 未加载
评论 #15342317 未加载
评论 #15345622 未加载
评论 #15342564 未加载
评论 #15347140 未加载
评论 #15342139 未加载
Waterluvianover 7 years ago
I want a terminal that highlights things it thinks are off. Like when I type cd cd or git git. But I don&#x27;t want it to auto fix nor wait until the command is issued to complain.<p>This is because I want to be the sole controller of what command is actually issued. Call me an old curmudgeon but I just don&#x27;t trust the auto fix solutions.<p>Edit: had no idea about Fish. Thank you, all.
评论 #15341746 未加载
评论 #15341728 未加载
评论 #15341722 未加载
评论 #15341931 未加载
bowmessageover 7 years ago
Why type out `git status`? I use `gst`, and lots of other great aliases provided by the [oh-my-zsh git plugin](<a href="https:&#x2F;&#x2F;github.com&#x2F;robbyrussell&#x2F;oh-my-zsh&#x2F;blob&#x2F;master&#x2F;plugins&#x2F;git&#x2F;git.plugin.zsh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;robbyrussell&#x2F;oh-my-zsh&#x2F;blob&#x2F;master&#x2F;plugin...</a>)
评论 #15341937 未加载
评论 #15343711 未加载
评论 #15341763 未加载
评论 #15342129 未加载
评论 #15342192 未加载
评论 #15342776 未加载
评论 #15346844 未加载
notthemessiahover 7 years ago
The mathematical term for a function that is the same when applied multiple times giving you the same results is called &quot;idempotent&quot; which translates to &quot;same power&quot;. f^n(x)=f(x) for some positive natural number n and any x.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Idempotence" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Idempotence</a>
评论 #15341875 未加载
empath75over 7 years ago
You can also just use &#x27;fuck&#x27; for this:<p><pre><code> &gt; git git pull git: &#x27;git&#x27; is not a git command. See &#x27;git --help&#x27;. The most similar command is init &gt; fuck git pull [enter&#x2F;↑&#x2F;↓&#x2F;ctrl+c]</code></pre>
评论 #15342069 未加载
js2over 7 years ago
Author missed an opportunity to title this &quot;Git git Git git git git Git git.&quot;<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Buffalo_buffalo_Buffalo_buffalo_buffalo_buffalo_Buffalo_buffalo" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Buffalo_buffalo_Buffalo_buffal...</a>
metrognomeover 7 years ago
Quite often, I accidentally press the space bar eagerly when typing git commands:<p><pre><code> $ gi tstatus </code></pre> To fix this, I&#x27;ve added the following to my .bashrc:<p><pre><code> gi() { args=(&quot;$@&quot;) args[0]=${args[0]&#x2F;t&#x2F;} git &quot;${args[@]}&quot; } </code></pre> It also works if you drop the &quot;t&quot; altogether.
评论 #15344867 未加载
nu11p01n73Rover 7 years ago
&gt; git config --global alias.git &#x27;!exec git&#x27;<p>Is the exec really required?<p><pre><code> git config --global alias.git &#x27;!git&#x27; </code></pre> Will also work. Am I missing something?<p>EDIT: From git doc, &quot;If the alias expansion is prefixed with an exclamation point, it will be treated as a shell command&quot;<p>So exec is not required then.
评论 #15345761 未加载
评论 #15345489 未加载
salgernonover 7 years ago
erm, &quot;git git foo&quot;; in most shells can be fixed with &quot;!*&quot; as your next command. Repeat until lameness subsides.<p>Seriously though, I don&#x27;t understand why people want to hide obvious errors like this - I&#x27;d much rather have the tool fail to execute than potentially perform some action I wasn&#x27;t expecting.
评论 #15351749 未加载
mimo84over 7 years ago
I never had the problem mentioned in the article, but for misspelled commands I trust git autocorrect:<p>git config --global help.autocorrect 1<p>It will run the correct misspelled command after 100ms. For example git stauts will be corrected automatically to git status <a href="http:&#x2F;&#x2F;schacon.github.io&#x2F;git&#x2F;git-config.html" rel="nofollow">http:&#x2F;&#x2F;schacon.github.io&#x2F;git&#x2F;git-config.html</a>
hackbinaryover 7 years ago
I tend to type Ctrl-C then a command. Ctrl-C clears the line for you, so you can be sure that you are starting on a fresh line.
bandramiover 7 years ago
While the cleverness is admirable, there comes a point in your life when you realize you really do always want your own errors to fail loudly and immediately.
评论 #15343498 未加载
z3t4over 7 years ago
Sudo should stop working if your error rate rises to unusual high
sgloutnikovover 7 years ago
Here are a number of great aliases that people might find helpful:<p><a href="http:&#x2F;&#x2F;durdn.com&#x2F;blog&#x2F;2012&#x2F;11&#x2F;22&#x2F;must-have-git-aliases-advanced-examples&#x2F;" rel="nofollow">http:&#x2F;&#x2F;durdn.com&#x2F;blog&#x2F;2012&#x2F;11&#x2F;22&#x2F;must-have-git-aliases-advan...</a>
steventhedevover 7 years ago
`!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 \&quot;git $*\&quot;`.<p>My version that works for my setup is `&quot;!f() { git \&quot;$@\&quot;; }; f&quot;`.<p>Hope this helps anyone who ran into the same issue, although I&#x27;m not 100% confident about the quoting.<p>EDIT: fixed the quoting, as per cryptonector&#x27;s suggestion<p>EDIT2: need to quote the quotes for gitconfig to use it correctly
评论 #15342103 未加载
mooglyover 7 years ago
Well... If you have this problem (I really don&#x27;t), then you probably have it with more than just git, and the proposed workaround would be &quot;a local solution to a global problem&quot;.
abecedariusover 7 years ago
Reminds me of this Python line:<p><pre><code> decorator = decorator(decorator)(decorator) </code></pre> <a href="https:&#x2F;&#x2F;github.com&#x2F;darius&#x2F;sketchbook&#x2F;blob&#x2F;master&#x2F;misc&#x2F;decorator.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;darius&#x2F;sketchbook&#x2F;blob&#x2F;master&#x2F;misc&#x2F;decora...</a><p>There was a subtle bug when leaving out the last (decorator). I know, it&#x27;s very silly.
isaratover 7 years ago
I have homegrown aliases like &#x27;tags&#x27; &#x27;rdel&#x27; (git push origin --delete) &#x27;ldel&#x27; (git branch --delete) and many more combined with Zsh&#x27;s (Oh my Zsh)&#x27;s several aliases (e.g ggpull, glog, gp, gc) etc.<p>I also find &quot;thefuck&quot; is interesting but I love to control my fate :) (<a href="https:&#x2F;&#x2F;github.com&#x2F;nvbn&#x2F;thefuck" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nvbn&#x2F;thefuck</a>)
shivenover 7 years ago
Why type the singular, &quot;git&quot;, so many times? We all know that you mean the plural &quot;gits&quot;!<p><pre><code> alias gits=&#x27;git status&#x27;</code></pre>
kobeyaover 7 years ago
This post would have been a lot better if he showed how to do a git subcommand that launched itself, which is where i thought he was going.
评论 #15341782 未加载
shruubiover 7 years ago
This reminds me of something I read long ago that was along the lines of &quot;make the computer change for you, don&#x27;t change for the computer&quot;. As such, I have a small list of common typo&#x27;s that I make that alias themselves to their correct forms.<p>Since then, I&#x27;ve found that these aliases have been the best workflow improvement I&#x27;ve ever made.
Myrmornisover 7 years ago
This is nice specifically because of the way the author uses `exec`. Without meaning to be patronizing, there must be lots of people reading the thread who don&#x27;t know what `exec` does, and why it&#x27;s a neat solution to this problem (or non-problem, whatever your view is); I&#x27;d say do look it up if you&#x27;re interested in programming.
评论 #15347403 未加载
itsashis4uover 7 years ago
After setting this alias in .gitconfig, I tried `git git log`<p>Works fine, but when I press quit (q), it says `error: exec git died of signal 13`
yeukhonover 7 years ago
As I was reading the article, I heard &quot;git git git git&quot; in the glitch audio form in my head... anyone?
评论 #15345711 未加载
busterarmover 7 years ago
I sometimes have this problem but I hate solutions like this because I figure if I make this kind of mistake, I&#x27;m not paying sufficient enough attention to what I&#x27;m doing at the moment.<p>I take a minute, clear out distractions and then come back to what I&#x27;m working on.
kazinatorover 7 years ago
Great for C programmers. Goes with:<p><pre><code> printf(&quot;Hello, world!\n&quot;); (printf)(&quot;Hello, world!\n&quot;); (*printf)(&quot;Hello, world!\n&quot;); (**printf)(&quot;Hello, world!\n&quot;); (***printf)(&quot;Hello, world!\n&quot;);</code></pre>
asveikauover 7 years ago
The danger of this is if you accidentally write &#x27;git git something&#x27; into a shell script and it works on your machine, then you commit the script to a repo and it doesn&#x27;t work for anyone else.<p>I suppose this is a problem with any alias.
评论 #15344987 未加载
评论 #15344207 未加载
Breakthroughover 7 years ago
It would be cool if you could generalize this for anything (e.g. ls ls -al). That being said, I wonder if there&#x27;s any actual command-line utilities that actually use a similar syntax to perform something useful.
jes5199over 7 years ago
great minds think alike? I&#x27;ve had this exact system for a long time: <a href="https:&#x2F;&#x2F;github.com&#x2F;jes5199&#x2F;git-git" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jes5199&#x2F;git-git</a>
Walkmanover 7 years ago
There is a GitHub repository full of neat tricks like this: <a href="https:&#x2F;&#x2F;github.com&#x2F;GitAlias&#x2F;gitalias" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;GitAlias&#x2F;gitalias</a>
temporallobeover 7 years ago
I often type &quot;git stats&quot; but I&#x27;ve never felt the need to go through all of this just because I&#x27;m lazy. Then again maybe that&#x27;s an ironic example of laziness.
bradezoneover 7 years ago
Why type &quot;git&quot; and walk away? Seems like an ultra edge case that deserves whatever ill comes from it.
taejoover 7 years ago
Does anyone else do `qgit`? `q` to quit the pager, but the output of the previous command unexpectedly fit on one screen.
tardo99over 7 years ago
I thought everyone used shortcuts for git. e.g.: `gs` means `git status` or `gpom` means `git pull origin master` etc
jrimbaultover 7 years ago
C-w would have solved that problem quickly :)
cup-of-teaover 7 years ago
Why is this a problem? Is the author blind? If this happens with git then surely it happens with every command. What about &quot;rm&quot;? What if I type &quot;rm -Rf&quot;, leave, then come back and type something else? Maybe a better solution is to change behaviour, or if there really is some reason for this behaviour, have something delete the currently entered command after it&#x27;s been idle for some seconds.
评论 #15345908 未加载
lamflamover 7 years ago
I find this much simpler: ln -s $(which git) [some dir in your $PATH]&#x2F;git-git
mbrumlowover 7 years ago
No, no I have not ever had too many gits...<p>(is this really a thing?)
IgorPartolaover 7 years ago
apt-get install sl
评论 #15342535 未加载
negativ0over 7 years ago
yeah it&#x27;s nice, git git happens! I have a lot of this shortcuts for git, zsh and especially for vim (:Q, :Qall, :QALL etc...)
stereobitover 7 years ago
Nearly as good as<p>alias gti=git
评论 #15347187 未加载
xelxebarover 7 years ago
Off-topic, but this site is pretty.
deeteeceeover 7 years ago
typing that means you probably needs some rest to let your brain refuel imo.
alex_dufover 7 years ago
also, I had to add alias got=&#x27;git&#x27; in my bashrc. Typo galore.
alkzover 7 years ago
how about looking at what you type instead of the keyboard?
Keloranover 7 years ago
you can also just get away with git = !&quot;git&quot;
rurbanover 7 years ago
At first alias g=git
alexchamberlainover 7 years ago
This is a manager problem, right?
4adover 7 years ago
This is a joke, right? It has to be a joke.
评论 #15342423 未加载
hellofunkover 7 years ago
At first I thought this title was pointing to the quirky symptom of Clojure&#x27;s default value for the &quot;get&quot; function that allows this statement:<p>(get get get get)<p>to be equivalent to this one:<p>get<p>as in:<p>((get get get get) {:a 1} :a)<p>I was very excited about an article on this topic.