Lesson 5

How Git Manages Conflicts and Collaboration

By using Git, you automatically get data protection features built into your project. This is what makes collaboration so (relatively) smooth. But even if you work alone, Git can reduce anxiety.
This lesson is: Just a stub [2014-04-10]

Sometimes when you’re slogging through a long writing or design project, you’ll pause – perhaps because you’ve just had a few drinks – and wonder, if I could just nuke this page/section/entire folder from orbit, I could have a clean slate for some new inspiration. So you take ten minutes, or an hour, to carefully back up your project, and then move the unwanted files to carefully labeled folders just in case you need to refer to something in the cluttery crap.

But then after a day or so, you might realize: having a clean slate didn’t help at all…now where did I put those trashed sections? The ensuing annoyance and/or panic is enough to keep you from ever radically experimenting again.

A Git/Github repo is, again, essentially just a folder of files, no different from past projects you’ve worked on. But they have inherent, built-in features that make it possible to revise, trash, and experiment with (almost) no regrets or anxiety. These features are key to how Git/Github have revolutionized open-source collaboration. But even if you plan to work alone, these version control features can still reduce anxiety and inconvenience.

TK: chapter in progress, more text to come

Conflicts

Note: If you’re working alone and on a single computer, you may never run into a “merge conflict,” just as you (hopefully) wouldn’t erase your own files while copying them the old-fashioned way. But just in case, this is a quick walkthrough on how Git protects you from accidentally wiping out data.

I don’t intend to get into Github’s full suite of collaboration features (they’ve got guides for that). But if you can clone once, you can obviously clone your repo from more than one computer. Which means you can edit and sync files from multiple computers.

So what happens when two different computers clone a repo, edit the files, and then try to sync with Github.com?

These sync-related conflicts a basic pain when it comes to working on Git-managed projects. But hell, they’re a major pain for any project that involves more than one person. You’ve probably run into this when a colleague has accidentally saved over one of your files.

One side-effect of managing your project through Git (actually, most would consider it Git’s raison d’etre) is that, automagically and behind-the-scenes, Git will keep track of changes and conflicts.

Placeholder images

img

img

img

img

img

img

img

img

TK

Deleting files

Let’s see what happens when we just delete a whole bunch of files…which is what we want to do now because we want to build a website from scratch, not from the pre-fab HTML files we’ve been working with so far.

More text, to be continued…TK

img

TK

Rolling back

More text, to be continued…TK

img

img

img

img

TK

Things we’ve learned

  • Why Git (and Github) is ideal for collaboration and experimentation
  • How to handle conflicts
  • How to delete everything
  • How to rollback big mistakes

…to be written

comments powered by Disqus

Lessons List