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.

Using Git Wrong

49 pointsby aarohmankadover 7 years ago

23 comments

hasenjover 7 years ago
This guy is espousing cargo cult version control.<p>&gt; This is how the Kernel team does it, so everyone should do it that way<p>99% of the time, your team has absolutely nothing in common with the Kernel team and it&#x27;s foolish to adopt processes from other teams without knowing why.<p>If anything, I would say the right way to use git in a small team is to always merge and never rebase.<p>Whatever you decide to do, make sure to think about <i>your</i> problem first, then use the tools to solve your problem.
评论 #15078968 未加载
评论 #15078957 未加载
rcthompsonover 7 years ago
I think it&#x27;s a fallacy to say that just because Git <i>allows</i> a completely decentralized organizational structure, that not using one is somehow wrong. The beauty of git and any other DVCS is that it doesn&#x27;t prescribe any specific organizational structure, so you&#x27;re free to adopt any structure you like on it. And critically, you&#x27;re free to change it when it makes sense to do so. I think the reality is that a centralized structure works best for most projects most of the time, but git has the flexibility to break out of that mold.<p>For example, maybe in one project most of the time everyone pushes and pulls from a centralized master and not to and from each other. But then two developers get together to try and solve a particularly troublesome bug. While they&#x27;re doing this, they can push and pull directly from each other without worrying about master, and then once they&#x27;re done, they can merge, clean up, etc., and then push the result to master. Git allows these kinds of pockets of decentralized development within an overall centralized workflow, and does so seamlessly.<p>Since Git allows any organizational structure, it&#x27;s up to the people working on a project to choose what works best for them. That&#x27;s a responsibility that they didn&#x27;t have before DVCS, because only one structure was supported by the tools.
评论 #15078925 未加载
评论 #15079126 未加载
agronaover 7 years ago
The author suggests one &quot;symptom&quot; of using git wrong is<p>&gt;Have you ever did a code review, and gave feedback that was longer than doing the fix yourself, while you’re at it?<p>But this seems to neglect the utility of teaching people to do things correctly. Sure, I could always just fix junior programmers&#x27; mistakes, but it seems better to educate them in the first place.<p>Sending the fixes back down doesn&#x27;t seem like it would have the same impact.
评论 #15078849 未加载
kazinatorover 7 years ago
&gt; while it was created to be used like in Linux kernel development. [ ... ]<p>&gt; * You have one online repository for every project (or even the entire code in case of a monorepo).<p>&gt; * Your repository&#x2F;repositories have one branch that everyone branch from and develop their changes against. (Release branches don’t count.)<p>The kernel has one main repo that integrates things from the others, the &quot;torvalds&#x2F;linux.git&quot;:<p><a href="https:&#x2F;&#x2F;git.kernel.org&#x2F;pub&#x2F;scm&#x2F;linux&#x2F;kernel&#x2F;git&#x2F;torvalds&#x2F;linux.git&#x2F;" rel="nofollow">https:&#x2F;&#x2F;git.kernel.org&#x2F;pub&#x2F;scm&#x2F;linux&#x2F;kernel&#x2F;git&#x2F;torvalds&#x2F;lin...</a><p>This keeps Linux together as One Thing. This is Linux&#x27;s CVSROOT, so to speek.<p>&gt; <i>You have one process that everyone have to follow to review the code; one review system and one place that runs all your tests.</i><p>No kidding; also: one payroll from which everyone gets paid and one product that customers understand: not seven versions of the product based on whose cubicle it came from. See the trend?
评论 #15078889 未加载
lobster_johnsonover 7 years ago
In our company, every developer must fork the main repo to their own account, and every change that they want merged into master needs to be done as a PR that is then reviewed by the right person. That&#x27;s a completely distributed process, and works great for a small company. We obviously need a central repo because apps need to be deployed from a single history -- a central master branch is not an antipattern, as suggested by the author. Even Linux has a central master branch.
评论 #15078979 未加载
godd2over 7 years ago
A linked list is a binary tree, and using git in a centralized fashion is a legitimate use of git.<p>Not everyone wants a distributed version control system, and not every team is ready for a more complicated process.
matt4077over 7 years ago
&gt; Have you ever did a code review, and gave feedback that was longer than doing the fix yourself, while you’re at it?<p>I always thought this process was sort-of intended. I feel it shows some respect to the author of the code under review to comment on it, and not to change it–especially not if that would result in changes that are then merged without first getting approval from the author. I&#x27;m having trouble finding the right words for this idea...<p>It&#x27;s also a way to teach people about coding standards and expectations for little things, such as spelling in comments.
评论 #15081933 未加载
评论 #15079195 未加载
评论 #15079056 未加载
colbyhover 7 years ago
Author seems to assume that all software development is like Linux development and it isn&#x27;t. I can&#x27;t have 10 different versions of my order processing service floating around doing different things for different people.
评论 #15078869 未加载
评论 #15078921 未加载
friendzisover 7 years ago
I see one major flaw in reasoning in this post: trust.<p>Lets pretend that architects are under team leads, seniors under architects, juniors under seniors, etc.. In this hierarchical model every layer forwards some responsibilities down the chain and <i>trusts</i> the task to be broken down, distributed further down and completed. In this model code reviews function merely as tools to <i>roughly</i> check for gaping mistakes and whether code fits &quot;architecturally&quot;. People are trusted to do their job to the best of their ability and are allowed to have personal style.<p>In a model where seniors go over everything juniors made, fix according to their own view and then commit we have a problems that lower layers are not trusted to do their job correctly and in the end everything has to strictly conform to product owner&#x27;s vision or will be &quot;fixed&quot; (rewritten). In this model there are no longer junior, mid-level, senior engineers, because the more minions one has under them, the less time they have to produce anything on their own. In this model there are junior, mid, senior code-monkeys and one mighty product owner who knows it all best. Not sure that environment where only career growth opportunity is ability to rewrite other&#x27;s code to your own liking would be good for team morality.
评论 #15079345 未加载
skrebbelover 7 years ago
What I really want is Subversion, but then without all the bugs and the weird file locking. And with easy release branches and a way to make commits locally and then share a bunch of them at once with my colleagues.<p>Of course no such thing exists, so I use Git which has these features but combines them with 10x worse UX and 10x more condescension from the community. But I put up with that, only because it&#x27;s the lesser of two evils.<p>I can&#x27;t imagine I&#x27;m alone in this.
评论 #15080859 未加载
评论 #15079136 未加载
评论 #15079059 未加载
评论 #15095355 未加载
ravitationover 7 years ago
I find this post quite amusing.<p>Many of the suggested methods of code sharing do happen, especially on large projects with multiple teams.<p>But the “one master branch” <i>problem</i> is not a result of missuing git... It&#x27;s a result of there being one version used in production... No git process change is going to change that.<p>His real issue seems to be with code reviews... Which isn&#x27;t really something unique to git...
nurettinover 7 years ago
The longer you keep your branch around &quot;to be battle tested and swapped across teams or modules&quot;, the more attention and time you have to pay keeping it updated. Cost increases as your branch &quot;gets battle tested&quot;. If your company can afford that, it&#x27;s fine.<p>This applies to pretty much any version control where you can create a remote branch.
Walkmanover 7 years ago
I have one comment for the article: LOL.<p>Seriously, the author probably never worked in teams with different sizes [1, 2], considered another workflows [3, 4] and skill levels of the developers (yes, that&#x27;s a variable you have to consider also!)<p>Also if you use Git in the same manner as CVS, you should do it because it&#x27;s much faster, more reliable and more flexible...<p>Edit: Ok, the author is saying things which I agree with, I was commenting on the click-bait title and the first paragraphs mostly, but still, there is more to the story.<p>[1]: <a href="https:&#x2F;&#x2F;m.signalvnoise.com&#x2F;the-majestic-monolith-29166d022228" rel="nofollow">https:&#x2F;&#x2F;m.signalvnoise.com&#x2F;the-majestic-monolith-29166d02222...</a><p>[2]: <a href="https:&#x2F;&#x2F;blog.bradfieldcs.com&#x2F;you-are-not-google-84912cf44afb" rel="nofollow">https:&#x2F;&#x2F;blog.bradfieldcs.com&#x2F;you-are-not-google-84912cf44afb</a><p>[3]: <a href="https:&#x2F;&#x2F;trunkbaseddevelopment.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;trunkbaseddevelopment.com&#x2F;</a><p>[4]: <a href="http:&#x2F;&#x2F;nvie.com&#x2F;posts&#x2F;a-successful-git-branching-model&#x2F;" rel="nofollow">http:&#x2F;&#x2F;nvie.com&#x2F;posts&#x2F;a-successful-git-branching-model&#x2F;</a>
Syttenover 7 years ago
These are nice ideas and I must confess that I never douted the way we use Git before reading the article. However, in the companies I worked for (and I think it applies to a lot of companies), the time constraints were too tight to allow more than form-based reviews. I do feel these reviews are sub-optimal and should be replaced, but checking out the repo and testing yourself is a very slow process that we mostly can&#x27;t afford. Most of the time the &quot;go fast, break things&quot; motus is applied and it&#x27;s fine if you are not building critical applications like a kernel...
chmikeover 7 years ago
We need a git repo holding the production version.<p>This is also where the continuous integration tests usually take place.<p>What is a good point of the OP is that people may not be sharing and testing code enough before pushing to the reference repo.
评论 #15078929 未加载
bsimpsonover 7 years ago
One interesting thought this article provoked:<p>Code review often catches typos, or edge cases that should be tested. As the OP points out, you end up serializing the problem into a comment, which the other developer has to deserialize, implement, and send back. Worse, these sort of issues often come across as nags - I&#x27;d be happy to fix a typo myself, but feel like a jerk calling someone else&#x27;s out. I rather like the idea of pulling down somebody&#x27;s diff, amending it, and pushing it back up. I&#x27;ll have to try that sometime.
评论 #15079321 未加载
评论 #15079153 未加载
dasil003over 7 years ago
&gt; <i>And you might just not be enthusiastic about that “distributed” idea at all. Maybe more top-heavy, centralized system is actually what you need.</i><p>Talk about throwing out the baby with the bathwater!<p>Just because you have a blessed master branch, and a central repo, does <i>not</i> mean imply you aren&#x27;t making use of your DVCS. You can still do all development on topic branches, including CI, and you can do it all in an asynchronous manner.<p>This idea of pushing branches between individuals in an ad-hoc fashion with whatever tools everyone wants to use makes perfect sense for something like kernel development where A) there is no single product running on a single production environment, it&#x27;s a freaking kernel deployed to billions of systems globally and B) you&#x27;re dealing with a huge set of people who you could never hope to standardize anyway.<p>When you&#x27;re shipping a complex product to a single production environment, it makes a great deal of sense to centralize certain things. Having everyone bike-shedding on a million different code review paths, and relying on each individual to pass their code around to other individuals with no single place where you can look to find out what someone was working on will lead a lot of chaotic inefficiency that will leave juniors confused, and all in the pursuit of some platonic ideal that is cargo-culted from a completely different project.<p>Don&#x27;t get me wrong, I think most people have a lot to learn about how to use git better, and I am a huge proponent of the value of a well-curated VCS history, but this article is inappropriately prescriptive nonsense.
alphaalpha101over 7 years ago
&gt;Have you ever did a code review, and gave feedback that was longer than doing the fix yourself, while you’re at it?<p>Yes. Yes yes yes. I hate this so much. I want my code reviews to involve fixing little things. I don&#x27;t even have suggested edits, I can only highlight comments and make comments, and even suggested edits wouldn&#x27;t be enough. I want to just make the changes. It&#x27;s all on a branch anyway.
评论 #15078971 未加载
Everlagover 7 years ago
&gt; The way code review is done: by looking on an output of diff command, pretty-printed in a web-browser, and pointing out obvious mistakes is very inefficient and fundamentally insufficient<p>&gt; open in IDE&#x2F;text editor of their choice with or along diff viewer, jump around the new code, run tests and even write some new ones, toy with it<p>This doesn&#x27;t scale. I know team leads in large projects where reviewing external contributions is their main responsibility; this style would be impossible.<p>Instead, I think the human, diff based approach with CI running against the reviewed code is enough. A reviewer going over the tests which are shown to be passing should be sufficient after the usual diff read-through.
chiefalchemistover 7 years ago
Ideally, shouldn&#x27;t all &quot;merges&quot; come from PRs? That, there&#x27;s a gatekeeper (or sorts) that helps to prevent sloppy, unnecessary and erroneous things from ever making it into the code base.<p>Just because (autonomous) you can merge and push, doesn&#x27;t mean you should. Right?
sreyaover 7 years ago
Under &quot;Changing Code&quot;:<p>&gt;It might seem like chaos, but it is not. It is just fluid synchronization, or to put differently: eventual consistency system.<p>Can anyone explain this? The example he used wasn&#x27;t fleshed out enough for me to understand how this system wouldn&#x27;t be chaos
评论 #15079191 未加载
feketegyover 7 years ago
Every once in a while there&#x27;s an article like this. S<i></i>t, use it how ever you want as long as makes you productive.
cntlzwover 7 years ago
git as a tool not a workflow. If you want to use git like a central VCS that is fine. git allows it. If you want to go fully distributed like the kernel devs. Fine, git allows it. As always, pick the approach that works best for your environment and not tell people they are wrong because of X and Y.