TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Flight rules for Git

203 点作者 spenrose超过 6 年前

17 条评论

smacktoward超过 6 年前
It never ceases to amaze me that:<p>1. Git, a software product with more footguns per square inch of user-exposed surface than any I&#x27;ve ever encountered, ended up winning the distributed VCS sweepstakes; and<p>2. Even now, more than five years after it was clear to everyone that Git had won, there is absolutely no momentum to go back and clean it up to <i>remove</i> any of those footguns. All we get instead are increasingly shiny GUIs to hide them under, and well-meaning blog posts advising you on which is the best kind of tourniquet to apply when you trigger one of the aforementioned footguns.<p>Sigh.
评论 #18231738 未加载
评论 #18230454 未加载
评论 #18230261 未加载
评论 #18230290 未加载
评论 #18232421 未加载
评论 #18230104 未加载
评论 #18232818 未加载
评论 #18230271 未加载
评论 #18231770 未加载
评论 #18232400 未加载
评论 #18234075 未加载
noxToken超过 6 年前
Everyone talks about how confusing Git is, and I think it&#x27;s because they do&#x27;nt understand what the commands do. Don&#x27;t get me wrong: you can royally screw up your repository with the wrong command, but 85% of your issues can be solved with checkout, pull, add, commit, push, merge, reset, status, stash, branch. When things get really heavy you may have to use rebase. And in spite of what people say, there is a nifty log that&#x27;s perfect for revisiting a snapshot of your CLI&#x27;s action: reflog.<p>When I first started using Git, I was told, &quot;When you want to make you commits public, use `git push -u origin &lt;branch&gt;` where branch the branch you&#x27;re pushing to.&quot; That advice is technically correct, but I had no idea what -u nor origin was. I took 5 minutes to decipher the command. I walked away understand that origin an alias for the remote server, and that -u associates a remote branch with your local.<p>I don&#x27;t think Git is the greatest thing ever. I do think there&#x27;s a bit of a learning curve. I also think that it&#x27;s not as complicated as people make it seem. This post is a great reference for how to do X in Git, but it&#x27;s a terrible source for beginners learning how to use Git. Cheat sheets are most effective when you have a basic understanding of the material.
评论 #18230437 未加载
评论 #18248988 未加载
评论 #18232806 未加载
lixtra超过 6 年前
I started version control with CVS. Just a bit better than copying.<p>I started distributed version control with monotone. That felt better but the central db felt a bit unnatural.<p>A bit later came mercurial and I was really happy with it. It all made sense. Easy interface and when you wanted to do something strange like rewrite history, you had to use a plugin.<p>Then came git (rhymes to better know your sh*t). I&#x27;m not surrounded by the smartest guys but most people I met only have a superficial understanding of git and looking at these flight rules kind of confirms the complexity of git.<p>I strongly believe that 80% of the current users of git would be better off with mercurial. But then everybody uses git for the remaining 20%.
评论 #18230159 未加载
评论 #18231489 未加载
评论 #18230085 未加载
Sir_Cmpwn超过 6 年前
One of the reasons git is &quot;hard&quot; is because too many people read crap like this, which rapidly gets outdated and often contains more bad advice than good. Read the manual! It&#x27;s not dry at all, and you&#x27;ll learn a lot. Pick a random git command and read its man page right now.<p><a href="https:&#x2F;&#x2F;git-scm.com&#x2F;docs" rel="nofollow">https:&#x2F;&#x2F;git-scm.com&#x2F;docs</a><p>Read the git book, too. It&#x27;s free and serves as a good introduction and helps you learn which man pages you need to consult and when. You don&#x27;t need to read the whole thing, but the first 3 chapters are indispensible.<p><a href="https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;v2" rel="nofollow">https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;v2</a>
评论 #18236558 未加载
wgerard超过 6 年前
A simpler guide, perhaps, made by an incredibly talented former co-worker of mine: <a href="https:&#x2F;&#x2F;ohshitgit.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ohshitgit.com&#x2F;</a>
评论 #18230573 未加载
marcosscriven超过 6 年前
Reminds me of the git man page generator joke site. <a href="https:&#x2F;&#x2F;git-man-page-generator.lokaltog.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;git-man-page-generator.lokaltog.net&#x2F;</a>
Klathmon超过 6 年前
This only briefly touches on revert commits, and instead shows a lot of (in my opinion) dangerous history-destroying commands.<p>Why aren&#x27;t reverts more widely used? It seems a lot of devs I&#x27;ve worked with don&#x27;t understand them, and to me they seem so simple and are so much safer than destroying&#x2F;rewriting history.
评论 #18231254 未加载
评论 #18230347 未加载
评论 #18230512 未加载
评论 #18231205 未加载
dschuler超过 6 年前
This is interesting - I like looking at corner cases of a tool to understand it better.<p>For people having difficulty with git, I recommend going through the official book [0] on a couple of topics with a toy repo and play with the tool a little bit. Another alternative is to find a simple workflow, and stick with it until you have time to explore git more.<p>Compared to other tools I&#x27;ve had to use in the past (AccuRev ughh), git is fantastic. Just being able to see what files have been modified without waiting for 10min+ or needing to be connected to a server changes your workflow, but we&#x27;ve probably become accustomed to those benefits, but still notice the arguably crusty command line.<p>[0] <a href="https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;v2" rel="nofollow">https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;v2</a>
okket超过 6 年前
FWIW here is a previous discussion from 4 years ago: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8102624" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8102624</a> (29 comments)
pvinis超过 6 年前
Any suggestions for quickly doing the following: When I clone a former repo on GitHub, I want to also add the original repo I formed from, as the upstream remote. This way I have the original repo which is mine and the upstream repo which is the original. So far I&#x27;ve been doing this manually.
评论 #18236731 未加载
jeffwass超过 6 年前
Seeking advice from the git masters :<p>I joined a new small team several weeks ago. All of us are fairly new to git, coming from cvs and svn backgrounds. We use Intellij as our primary IDE, and bitbucket as our remote origin.<p><i>Do y’all recommend using the IntelliJ git front end GUI, or calling git from the command line?</i><p>I thought I had a grasp of git from some side projects on GitHub, but now that it’s a key dev tool in our daily process, the more I learn about it and need to extend beyond simple checkout&#x2F;commit&#x2F;push workflow, the deeper the rabbit hole goes.
评论 #18232645 未加载
评论 #18237645 未加载
kureikain超过 6 年前
IMO, by blindly follow these kind of cheatsheet, you will hard to get better with Git.<p>I used to remember command in certain situation and have a hard time understanding stuff like stash, rebase, cherry-pick, detach head etc...So whenever come up I have to sit google the heck out of it.<p>Then one day I decide to sit down and just read Git properly. They are on: <a href="https:&#x2F;&#x2F;git-scm.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;git-scm.com&#x2F;</a><p>Eventually I understand it better and now I know what I need to do in certain situation.
spenrose超过 6 年前
I also highly recommend Learn Git The Hard Way. Most developers who spend an afternoon with it will come away with a firm understanding of git&#x27;s core abstractions.<p>Book: <a href="https:&#x2F;&#x2F;leanpub.com&#x2F;learngitthehardway" rel="nofollow">https:&#x2F;&#x2F;leanpub.com&#x2F;learngitthehardway</a>
xtracto超过 6 年前
I was surprised there is no mention of git bisect... an incredibly useful tool.
projectramo超过 6 年前
Isn&#x27;t the first rule, never talk about Flight rules?
anonuser123456超过 6 年前
If git confuses<p>Read chapter 10 of pro git<p>Mourn enlightenment
Narew超过 6 年前
that remember this so much <a href="https:&#x2F;&#x2F;xkcd.com&#x2F;1597&#x2F;" rel="nofollow">https:&#x2F;&#x2F;xkcd.com&#x2F;1597&#x2F;</a>