Version Control With Git: Dylan Nugent
Version Control With Git: Dylan Nugent
Dylan Nugent
Agenda
Our goals
• Share code (or something else) easily
• Keep track of any changes we make (and undo them with
ease)
• Maintain multiple versions of the same project/code base
• Clearly communicate what changes have been made
Let's quickly talk about what goes into a repository (and what a
repo is)
Git (and other VCSes) get their power from working on files
where changes can be easily seen (i.e. not binary files)
Let's Get Started (Setting up Git)
We can also tell an active repo where the remote origin is:
git remote add origin nugent5@yt:~/davesdots.git
Best practices for code collaboration
When to commit?
• Source of major arguments (big changes vs small change)
• Never put broken code on the master branch (test first!)
• Try not to break things (don't do two weeks worth of work in
one commit)
• Always use a clear, concise commit message
o Put more details in lines below, but always make the first
line short
o Describe the why; the what is clear in the change log
• When making giant changes, consider branches (we'll talk
about these in a few slides)
• Oh, and make sure your name and email are right
Resolving commit conflicts
So what is a branch?
• Exactly what it sounds like!
• By default, everything is on the master branch
• We can make changes on another branch
Basic operations:
• pick -- Use this commit
• reword -- Change the commit message
• squash -- Make this commit part of the above commit
Github
Locally accessible repository
Bare repos (what's special about the origin)
Gitosis
Additional Powers of Git