Live data from Hacker News

Oh shit, git: Getting myself out of bad situations

ohshitgit.com

21–30 of 520 posts

Re: Oh shit, git: Getting myself out of bad situations

#21
I've said this before, but the business leadership, and tech leadership, need to think carefully about whether or not they need all of the power of Git. This sums up my concerns:

-----------------------

Here are some minor failure modes I’ve seen with Git:

1. a branch that stays open for many months, perhaps even a year (for instance, at Maternity Neighborhood)

2. data is erased for good because someone makes a mistake while using rebase

3. a developer introduces a new bug while trying to resolve a merge conflict

4. widespread but fine-grained cherry picking leaves the team unclear about what’s been merged and what has not been merged

5. a developer makes a change in the wrong branch because they forgot what branch they were in

6. a developer is unable to recover a stash because they forgot where they were when they created the stash, or they simply forget that they have work in a stash

7. developers confused by working in an unattached commit, after a botched attempt to revert

8. a developer feels the need to delete the repo from their harddrive and clone it again, because the whole repo got into a state that they seemed unable to resolve

9. the “blame” command is nearly useless — maybe its because we never know in which branch a given change was made, finding who made a mistake is very difficult

10. developers get confused about which branch will be deployed (I see this especially in shops that have lots of repos for lots of small apps, and use different Git workflow strategies for the different repos, often because different programmers or different teams control the different repos)

11. developers push their changes to “origin” but forget to push to “upstream” or vice versa.

But all of that stuff is trivial compared to the major flaw:

Graphic designers, writers, HTML/CSS frontenders, managers, data analysts and QA staff can’t use Git, even though they all used Subversion.

http://www.smashcompany.com/business/business-productivity-h...

Re: Oh shit, git: Getting myself out of bad situations

#26
post #14
post #9

Is it just me or did http://ohshitgit.com/#accidental-commit-master forget to checkout master before calling reset?

It's still on master because `git branch` just creates and doesn't do checkout. (Which is why I've almost exclusively switched to `git checkout -b ` for creating. How often do I want to create but not switch to the branch?)

[deleted]

Re: Oh shit, git: Getting myself out of bad situations

#27
post #11

> Oh shit, I accidentally committed to the wrong branch! I find cherry-picking to be easier in this case. Just checkout the branch and cherry pick commits from 'wrong' branch. https://git-scm.com/docs/git-cherry-pick

But then those commits are still in the wrong branch. If I accidentally commit something to master instead of a development branch, I can't deploy master until my development branch is merged in, as the one commit isn't ready for live.

Re: Oh shit, git: Getting myself out of bad situations

#29

In three years of using git I believe there is a single bad command that I could not undo: `git checkout -- somefile` The second worst thing I did is losing a commit in a `git rebase -i` but I was able to find it back with `git reflog`. Which makes me think that git is really well designed.

If by "designed" you mean "picking a content-addressable DAG as an underlying data structure", then yes, it is really beautiful. If you mean "provide a sane level of abstraction over said data structure", then hell no!

Re: Oh shit, git: Getting myself out of bad situations

#30

Nice. For anyone who hasn't see it, Flight Rules for Git is even more comprehensive: https://github.com/k88hudson/git-flight-rules

I'm planning on making a hard push for git on the team I just joined (that isn't using any VCS). This and OP are going in my bookmarks.
Post reply on HN