Git by pengxiang



The fast version control system
                    Who am I?
• Senior Software Engineer and Code Chameleon with
  SRA International, Inc
• Coding in HTML and ColdFusion since version 2 of each
  (1995 and 1998 respectively).
• Master of Information Technology.
• Maintainer of “The Girlie Code Blog” at
• Can be reached at
• Download this presentation from (I will put it in a direct link
  in the toolbar)
•   What is git?
•   Distributed?
•   Why is it different?
•   What are it’s drawbacks?
•   What are it’s benefits?
•   Demos
                What is git?
• Git was created by Linus Torvald around 2005
  and is based on ‘bitkeeper’.
• Git is a distributed version control system (see
  next slide).
• Comparable to CVS, SVN, PVCS, VSS but also
  wholly and entirely different.
• Open source.
Most Version      Linus’ Vision of Git   Reality of
Control Systems                          Distributed Systems
                Design Criteria
1. Take CVS as an example of what not to do; if in doubt,
   make the exact opposite decision. (Torvald is quoted
   saying incredibly rude things about both CVS and SVN
   and in some cases, he’s dead right, the rest are
   probably just matters of opinion)
2. Support a distributed, BitKeeper-like workflow
3. Very strong safeguards against corruption, either
   accidental or malicious corruption.
4. Very high performance.
           Why is it different?
• Distributed – does not require a central
  repository or even network access.
• Fast – designed for speed.
• Nearly incorruptible – authenticates file
  downloads using cryptographic grade hashes.
• Compatible - uses http, ftp, ssh, rsync or git
• Better merge capability and independent nature
  mean you can actually use it ALONG with another
  version control system.
• Distributed methodology makes it difficult for
  some people to track multiple branches with the
  same/similar name.
• Uses different terminology, sometimes the same
  word for a different thing. (a common problem
  when switching version control systems)
• Extra steps after ‘check-in’ to actually push to
  central repository.
• These drawbacks can be mitigated with proper
• Fast. Orders of magnitude faster than some version
  control systems (tested by mozilla – results:
• Most version control systems get confused the second
  time you merge one branch to another, moreso if there
  has also been a merge from a third branch or changes
  to the branch you are merging to, this doesn’t happen
  in git, it uses realtime diffs (similar to compare in svn
  and cvs).
• You can use it locally with no central repository, or
  designate one of the developer computers as central
  repository. (huge benefit)
               More Benefits
• It can be run on a development box, with
  connections from other developer’s computers
  without a huge performance hit.
• You can use it to push the code live even if your
  live server is not set up as a git repository.
• You can access files based on commit comment.
• Commit comment is required in most git tools.
  (you can’t speak for the content of the comment,
  but at least it has to exist)
• fetch - allows examination of changes before
  committing locally, but only on files that would
  have conflicts. Similar to cvs synchronize or
• pull - get the full repository, similar to cvs replace
• push - similar to check in, but of whole branch,
  pushes branch to final destination
• checkout - useful for rolling back to a branch, tag
  or commit comment Similar to pulling an old
  version to commit it.
              More vocabulary
• HEAD - current branch (a change from what most
  of us are used to).
• master - same as CVS HEAD this is the main
• clone - create a copy of a repository stored locally
  or elsewhere. (similar to initial check out in CVS)
• commit - create a 'changeset' or 'revision', similar
  to cvs commit, but NOT to the central repository.
               git workflow
• Fetch or clone (create a copy of the remote
  repository) (compare to cvs check out)
• Modify the files in the local branch
• Stage the files (no cvs comparison)
• Commit the files locally (no cvs comparison)
• Push changes to remote repository (compare
  to cvs commit)
               How to get git.
• Source code repository: http://git-
• Windows tools – all come with full copy of git
  – Cygwin
  – tortoiseGit (can interfere with vpn’s)
  – MSYSgit (most recommended)
• eGit for eclipse
       How to get help with git
• Read That Fabulous Manual
• Books (free)
• Online training:
• Git user groups online
• Git mailing lists
                Git Hosting
• For projects that do not require FISMA
  Certified and Acredited hosting, you can view
  a whole list of git hosting sites here:
• Speed demo – pull the entire git codebase
  from central repository.
• Replace/eGit demo – replace current branch
  with a copy of a remote branch.
• Merge demo – local.
• Display history/branches. View file list by
  commit comment.

To top