David's (section 2) notes on GIT

advertisement
An Introduction to Git
David Johndrow
COMP 490 – Senior Design & Development
2/11/16
Brief History
• Created as an aid in developing the Linux kernel
•
•
•
Changes to Linux were initially handled manually
Later, a proprietary version control system called
BitKeeper was introduced
When the Linux dev team’s free access to BitKeeper
was revoked, they needed a new version control
system
Linus Torvalds: Creator of Linux, lead
developer of Git, king of the nerds
(source: https://plus.google.com/u/0/+LinusTorvalds)
Brief History (cont’d)
•
The Linux team had several needs in their new version control system:
•
•
•
•
•
Speed
Simplicity
Support for branched development
Ability to support large projects quickly and efficiently
The tool they developed would be known as Git, which is still widely used today
(source: https://git-scm.com/book/en/v2/Getting-Started-A-Short-History-of-Git)
What is Git?
•
Git is a version control system
•
•
•
•
Other VCSes include SVN, Perforce, and Mercurial
VCSes track the changes made to a collection of files, usually called a repository
Managing changes to your program is much easier and cleaner when version
control is used
Typically version control is used for team projects, but even for individual projects
the benefits are too good to pass up
Organization of a Git Project
The working
directory is where the
files on your
computer are stored.
When you have changes to your
project you want to save, you add
them to a staging area, still on
your computer.
Each batch of changes you make
is called a commit.
Once you’ve finished
implementing your desired
feature, you’ll commit your
changes to the repository on
your machine.
Local
Machine
Remote
Server
Working Directory
git add
Repository
Staging Area
git commit
Repository
Finally, you’ll upload your
finished commits to a remote
server, where your project’s
master repository is stored.
git push
(source:https://git-scm.com/about/staging-area)
Branching
• One of the most powerful features of Git is the ability to work on separate
branches.
•
This is very useful, almost essential for any project being developed by a large group,
or any sufficiently involved project.
• Branches allow users to develop features on separate versions of the code,
then integrate them into the master version once they’re finished.
Live Branching Demo
This is a nice sandbox program for getting a sense of how branching works in
an actual git environment in a more visual way.
It also helps to demonstrate how to interact with git through the command
line.
http://pcottle.github.io/learnGitBranching/?NODEMO
Download