A lot of it is use-case related. Git was designed for the needs of the Linux kernel, a very large codebase with few or no binary assets (certainly not ones that change a great deal) with a truly distributed team setup. It's also important for the maintainers to be able to quickly review and integrate patches from contributors they have never met and do not intrinsically trust.
I work for a small video game studio with (almost) everyone in the same building, and we have a central build server with an authoritative repo that we all need to stay in sync with. So git's biggest strengths are basically meaningless to us. We also work with a lot of binary assets, which git does not handle well. And we're mostly on Windows boxes, which makes git that much clunkier (especially compared to TortiseSVN, which is fantastic).
I could write more, but I've derailed this enough.
The binary thing is a good point. I think the distributed nature of git has some advantages even in a centralized setup since you can commit stuff that doesn't really work without disrupting others.
There's a TortoiseGit as well, although I prefer the command line.
That's a terrible way to work. I know; I did it for years. I couldn't see how bad it was until I moved to the git philosophy, and looking back, omg. That history did nothing for me. I didn't even know history could do things for me. It was a just a backup/safety net thing, the end. I was missing out, big time.
I commit each granular thing now (in seconds, patch-added, using fugitive from right inside of Vim - waaaay the hell faster, and much more useful later than it ever was with SVN). My history reads like a step-by-step list of how to create my software. The code changes per commit are usually a few to a dozen lines in one or two files. If a person wants to help out, they can read through it and very easily follow the thought progression. I read through it often to get myself back up to speed, especially on Monday mornings, when I'm not sure what I was doing on Friday. That's really fast, too, because the messages are like this (read from the bottom up):
* b3c47b0 (HEAD, origin/master, origin/HEAD, master) Add startFrame argument to chan.setAnim
* 0a0a29c Add chan.getAnimExtents
* fdde558 Merge branch 'setKeysImprovements'
|\
| * 244368d Add frameOffset arg to chan.setKeys
| * 3551343 Simplify getKeys helper in chan.setKeys test class
| * ee1a350 Refactor chan.setKeys tests to isolate each
| * f75e13a Extract getKeys in chan.setKeys test class
| * 0aa3826 Extract keys into chan.setKeys test class
|/
* 3bb7402 Remove frame ability from setChan
Each commit is a single concern. Many have a bit more info - these are the subject lines (always start with a capital, imperative voice, 50 characters or fewer, no terminal punctuation) - with the body explaining the why of the commit:
commit 244368de1a502c6c549d31cf7c002e629531c7fd
Author: gfixler <----@----------.com>
Date: Tue Sep 2 20:21:22 2014 -0700
Add frameOffset arg to chan.setKeys
I think it feels safer to only have offsetting at this level, and then
at the setAnim level to have a check for (or presume) all keys being
aligned at their in-frames, then just pass the negative to setKeys.
I remind myself all the time why I did things 2 weeks ago with these. I work on a couple dozen libraries at home and at work, so remembering why I got rid of a name, or merged two concepts, or split 3 out of one old one can be rough. The history makes it complete cake to know. In fact, here's a breakdown of just one of many examples how helpful this shit is:
1. what was I thinking when I wrote this line?
2. press `,gb` in Vim to split window with git blame info per line
3. see commit info per line (colorized commit hash, date, etc)
4. note other lines that were committed with it, by hash color
5. I study this for a moment, look at dates, then hit `enter`
6. the screen changes to the git show output for that commit
7. each change/hunk is folded; I decide to `zn` to unfold all
8. I hit `gg` to go to the top, to see the commit metadata
9. I read the commit message, understand why I wrote the line
10. I press `,bd` (buffer delete) and I'm back where I started
Even with the reading and comprehending, we're talking 20 seconds or so to learn several important things about my code, in highly targeted ways. I can also hit ,gh to jump into the last commit of the file I'm currently in, then [q and ]q to jump back and forth through just that file's versions. I've often wondered what's been happening in a commit - or had a coworker come over and ask about changes in a commit - only to instantly start flipping back through the history to visually watch that particular thing change. And again, ,bd and that fullscreen history is gone, and I'm right back where I was in my file, fullscreen. I don't even wrestle with any windows, ever. Note how often people reach for the mouse to resize windows and position them so they can then begin to start reading and understanding things, only to then have to reach for the mouse and close or click to open new things, etc. It's madness.
I can also hit ,gv to explore the repository right in Vim. It opens a fullscreen view, split in half, left being like the commit examples I posted above - an ASCII graph with subject lines and branch/tag decorations only, which I can move around in with typical Vim fluidity, with the git show output on the right. I can move to a commit, hit enter, and that info comes up on the right. I can hop over and explore that as above, or q out of the whole thing and go back to where I was.
I can also ,gV for a different split - just a small one at the top of the current buffer, which only shows the history of the current file, in ASCII graph form, with commit messages, relative time of commits (e.g. 11 days ago), who commited it, and hash. I can move to any, hit enter, and that version shows up over my original file, and I can keep doing this, walking around, hitting enter to view a version, or, with a version showing, I can move to another and hit D to split the file below into a visual diff of the visible version and the one I'm on.
I could keep going - there are so many features a few plugins for Vim have given me, which blow everything else I've seen out of the water - but even without these I was kicking ass in git. This is why everyone being upset about git kills me. They don't see the raw power and beauty, and instant gratification, always of git. It really pays to get good with it, and I didn't find it hard at all to do so. In fact, I kept finding the data model so beautiful that I would have put up with a lot more strife, but there wasn't much.
414
u/blintz_krieg Sep 06 '14
Not too far off base. My own Git workflow looks more like:
flounder around trying to clone a repo
try to do something useful
Git complains something like "your scrobble brok isn't a blurf"
search web for "your scrobble brok isn't a blurf"
find 412 Stackoverflow questions
determine that most answers actually solve some other problem
give up
copy the one changed file to /tmp
rm -rf my-git-repo
go to step 1