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.

Oh shit, git (2016)

412 pointsby IvarsIndriksabout 6 years ago

21 comments

dnprockabout 6 years ago
Reading this article, I realize that I&#x27;m old now. I still remember wrestling with cvs, svn. Merge, branch were slow and even more challenging. It was much easier to mess up and so difficult to rewind.<p>When I first learned git, I thought it&#x27;s pretty neat. It solves merge, branch, rewind problems. Git is one of the things in life that doesn&#x27;t work like the way we think. But it turns out to be a better way.
评论 #19907242 未加载
评论 #19907418 未加载
评论 #19910198 未加载
评论 #19907496 未加载
dwaltripabout 6 years ago
Git is pretty nice, but I&#x27;m sure there is something much better waiting to he invented. The CLI in particular could use a ton of improvements.<p>And I feel it in my bones that there is a revolutionary GUI waiting to be invented. Why can&#x27;t I drag a commit or set of commits from one branch to another? With safe, easy undo (reflog doesn&#x27;t count) and super smooth conflict resolution? Etc etc.<p>And of course there is the interesting rabbit hole of semanitc &#x2F; language aware diff. Line diffs suck in many ways.<p>It&#x27;s one of the hundreds of of problems that I&#x27;d love to work on one day, but probably won&#x27;t get a chance to. Sigh... :)
评论 #19907717 未加载
评论 #19907394 未加载
评论 #19908233 未加载
评论 #19907377 未加载
评论 #19909623 未加载
评论 #19907345 未加载
评论 #19910904 未加载
评论 #19908110 未加载
评论 #19907814 未加载
评论 #19913821 未加载
评论 #19907419 未加载
评论 #19907824 未加载
评论 #19910333 未加载
dzdtabout 6 years ago
Am I the only one who reads &quot;reflog&quot; as &quot;re-flog&quot;, that is, to be painfully whipped again?
评论 #19908818 未加载
评论 #19908883 未加载
评论 #19908348 未加载
gpvosabout 6 years ago
One thing that I had been looking for for a long time, but never could find, was a description of the several syntaxes you can use to refer to specific commits. Lots of git tutorials use these magic incantations, but none point you to this crucial bit of explanation.<p>Recently I discovered that it is found under &quot;git help revisions&quot;.
评论 #19908775 未加载
评论 #19909153 未加载
saagarjhaabout 6 years ago
&gt; I committed and immediately realized I need to make one small change!<p>I think it might be nice to add a disclaimer saying that this is not advisable if you&#x27;ve already pushed the code. Suck it up and make a new commit–don&#x27;t rewrite public Git history.
评论 #19907077 未加载
评论 #19907167 未加载
评论 #19907094 未加载
评论 #19907119 未加载
评论 #19908876 未加载
评论 #19907032 未加载
spenroseabout 6 years ago
Same idea, but much more comprehensive: <a href="https:&#x2F;&#x2F;github.com&#x2F;k88hudson&#x2F;git-flight-rules" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;k88hudson&#x2F;git-flight-rules</a>
sadness2about 6 years ago
I prefer this, because it has a flow-chart <a href="http:&#x2F;&#x2F;sethrobertson.github.io&#x2F;GitFixUm&#x2F;fixup.html" rel="nofollow">http:&#x2F;&#x2F;sethrobertson.github.io&#x2F;GitFixUm&#x2F;fixup.html</a>
dangabout 6 years ago
2017: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=15951825" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=15951825</a><p>2016: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12459755" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12459755</a>
zoomablemindabout 6 years ago
Git is nice tool, very versatile in able hands. Thanks to its promotion (plugins and github included), the pragmatic practice of source versioning gained wider adoption and lost that beg-your-IT-dept-to-set-it-up flair.<p>In the mean time, &#x27;thanks&#x27; to Git, the source change history became a maintenance line-item. The expectations of a clean history were raised almost to the level of expectations for bug-free code.<p>I can see a utility of clean feature history, but asking developers to craft the history is shifting their focus away from the actual code. As long as the source state has been saved, the source control has done its main job.<p>So for the most of the listed &#x27;shits&#x27;, the developer should just be able to revert, cherry-pick, and re-commit, and keep going. Nothing esoteric and hard to remember, also fairly common commands across different VCS tools. Shit happens and will happen again, no biggie, no need to blame and shame, source annotation will show the right change&#x2F;comment anyway.
systemBuilderabout 6 years ago
Git performs like what it is : a piece of code created by debugging a blank sheet of paper. I can detect almost no philosophy and no simplifying assumptions. The thought that you need 60+ commands (the current size of my git cheat sheet, including all the bizarre argument incantations which seem customized for all 100+ possible mistakes in git) to get through the day is an abomination. I prefer perforce which requires less than 20 commands. The only reason people use git is because, Linus.<p>Like no good program, ever, to use git you have to understand all the compromises and all the internals of its data structures. What a joke.
luxcemabout 6 years ago
&gt; I use reflog A LOT<p>If you need to reset with reflog a lot you&#x27;re probably using git wrong.<p>Sure it can be useful but I don&#x27;t see why it should be in a workflow.
jancsikaabout 6 years ago
&gt; git diff --staged<p>The way it worked well was that the &quot;--staged&quot; flag would be implied if you had already staged some files to be committed.<p>But on this day I noticed that nothing bad happened from that behavior. So I time traveled back and whispered to the git devs that the interface should be made more pedantic to keep users from relying too much on git to do the right thing for them.<p>Now it&#x27;s great because users suffer and I have plausible deniability from this now being on par with the rest of git&#x27;s interface.
vijaybrittoabout 6 years ago
This has been immensely useful every now and then
ghiculescuabout 6 years ago
&gt; git reset HEAD~ --hard<p>Seems fairly magical compared to other stuff here. To me at least. Can anyone briefly explain what it does?
评论 #19908642 未加载
评论 #19908708 未加载
ddtaylorabout 6 years ago
Many of these problems can be avoided by using a pull-request style workflow.
评论 #19908528 未加载
评论 #19907944 未加载
评论 #19909637 未加载
reacwebabout 6 years ago
Oh shit, this commit message buried by new commits must be fixed before it is propagated to other repositories.<p>Oh shit someone has fixed an old commit message that was already pushed to other repositories.<p>Oh shit, this commit ough to be a merge commit. The tree is good, but not the parents.
js4everabout 6 years ago
Thanks for this excellent cheat shit
BuildTheRobotsabout 6 years ago
The last example [0] really should reference the obligatory XKCD [1]<p>[0] <a href="https:&#x2F;&#x2F;ohshitgit.com&#x2F;#fuck-this-noise" rel="nofollow">https:&#x2F;&#x2F;ohshitgit.com&#x2F;#fuck-this-noise</a><p>[1] <a href="https:&#x2F;&#x2F;xkcd.com&#x2F;1597&#x2F;" rel="nofollow">https:&#x2F;&#x2F;xkcd.com&#x2F;1597&#x2F;</a>
rich-teaabout 6 years ago
Git is not hard. It&#x27;s very simple. But people learn it the wrong way. You have to learn it from the DAG up. If you cannot grasp how the DAG works you&#x27;ll forever be reading and writing articles like this one which do not help you to learn.<p>This is a horrible article. You should not bookmark it or use it. If you&#x27;re not a programmer, you shouldn&#x27;t use git. If you are a programmer, do yourself a favour and spend a day going through something like this: <a href="https:&#x2F;&#x2F;wyag.thb.lt&#x2F;" rel="nofollow">https:&#x2F;&#x2F;wyag.thb.lt&#x2F;</a><p>It will make you better at git and better at programming. Git is a powerful tool and you need to <i>learn</i> how to use it. Imagine if people read articles like this one instead of learning how to drive.
评论 #19907121 未加载
评论 #19907131 未加载
评论 #19907136 未加载
评论 #19907205 未加载
评论 #19907143 未加载
评论 #19907129 未加载
评论 #19907100 未加载
评论 #19908445 未加载
_pmf_about 6 years ago
I don&#x27;t get this &quot;afraid of losing something&quot; mindset at all. In fifteen years, I&#x27;ve &quot;lost&quot; some minor changes maybe 3 or 4 times, and this was mostly with SVN, which does not have the safeguards that Git has. The only thing that I am moderately afraid of is pushing to the wrong remote branch.
评论 #19907511 未加载
评论 #19907246 未加载
scarejunbaabout 6 years ago
Honest to god, I don&#x27;t know how people who find `git` hard to use manage to write code. Everyone on the Internet acts like the concepts are impossible to grasp and it&#x27;s like really easy to grok.<p>Honestly, it faded into the background of code from the beginning. I mean, I know &quot;Forward-port local commits to the updated upstream head&quot; means nothing to anyone not already familiar with `git rebase` but a practical mastery of the tool is very easy to achieve.<p>I honestly think this is a pedagogical lack. We tell everyone it&#x27;s this complex thing and that they should be scared of rebase and the reflog and they believe it. Maybe if we didn&#x27;t, it&#x27;d be easier.
评论 #19907265 未加载
评论 #19907217 未加载
评论 #19907704 未加载
评论 #19907670 未加载
评论 #19908338 未加载
评论 #19908805 未加载
评论 #19907197 未加载
评论 #19907498 未加载
评论 #19907175 未加载