How To GitHub: A Complete Guide to Forking, Branching, Squashing and Pulls
gun.io
gun.io
I hate git with a passion now. Its like forcing everything through its world view, for the tinies action it barks are you with insane messages.
Version control systems are supposed to model commits or sets of changes on a repo, not model and show you their own internal representation of what it thinks about my code.
Also Ive noticed most git tutorials really simple things (like this is how you do cvs but now with git), while "the rest" is left to some black ninja voodo magic expert dudes who "get" it.
And this is just another tutorial to work in a very specific environment using git.
Im so glad we use mercurial at work right now.
The best thing to do is create some "play" git repositories and see what happens when you run any command. You can also run "git clone" on local directories to mimic actual remote repositories without having to set anything up. Don't worry about screwing anything up as you can just delete the directory and start over.
Bonus points for never doing a (non fast-forward) merge of upstream branch into your branch (if you plan to merge your branch back into the upstream one later). If you do need to update your branch before it gets merged, rebase it instead.
What to do if your public branch needs to be updated from upstream? Create a fresh one off of upstream, merge your branch into it, and continue working on a new one.
Learn how to use `git reflog` to recover if you botch it up.
The golden rule is: rebase your own stuff all day long, as much as you want. Don't rebase once you've published.
Rebase is a tool for reasoning about your changes as a collection of logical transformations. It's to help you prepare a patch to share with the team. Interactive rebasing (and squashing, fixups, etc) are there to let you checkpoint your work as you go and to give you the freedom to come back and reason about your patches later.
Once I got comfortable with rebase, I began using it as a tool to help me write code. By that I don't mean putting characters into a text file. I mean teasing out isolated changes without interrupting the flow of bigger tasks.
The fear of rebase comes from people who are used to centralized version control systems. They view their version control system as a tool for backups and accountability. Git provides sha1 hashes for backups/security/accountability. Everything else git does is to help you write, reason about, communicate about, share, separate, combine, and otherwise fiddle with patches as logical changes.
If you don't want people to rewrite history, don't give them push access to your repository. Everyone has their own, right? If you want to prevent people from accidentally rewriting canonical history, disable --force pushes to your team's shared repository using a pre-commit hook. But in reality, that won't be an issue because as soon as some one accidentally force pushes, everyone else will have their pulls broken and know the perpetrator immediately identified for flogging.
This is a great rule of thumb, which I have had to repeatedly drill into my team-mates. The crux of the problem, I've come to realise, is that people can't differentiate between a "local" commit and a "published" commit.
Git tutorials need to focus a bit more on the nature of git than on simply showing the basic operations.
[alias]
l = log --oneline --decorate --graph
la = log --oneline --decorate --graph --all
--online --graph : Will really help visual learners--decorate : Makes it super obvious how labels and tags work
--all : Extends the usefulness of --decorate to branches and remotes
they mention that they release the source, and list alternatives to the terminated product BEFORE sending you over to their google docs.
I enjoy the disorganized nature of GitHub, but there are some serious faults. I think they can probably be overcome by rationality and standard practice (clear communication, being polite, documentation, etc). Politically, I see myself as a 'vulcan anarchist' so it's fun to see GitHub as a little microcosm of intelligent anarchy.
From order, chaos. From chaos, order.
A huge team at work, never any mercurial problems/error messages. Just code man. Just code.