3. Outline
• What is git?
• What is a Version Control System (VCS)?
• History of git
• Key concepts and basic git commands
• How does git works?
• What is Github?
• Basic Github Concepts
• Understanding Github workflow
5. • Tracking your code revision history
• Unable to undo errors and roll back to earlier code
versions
• Sharing your codebase with a collaborator
• Merging collaborator’s code to your code
The problem
9. Version Control System is…
• a way to manage files and directories
• a way to track and manage file changes so that you can
recall specific versions later
• a way to share a codebase to a collaborator without any
trouble
• a way to merge your collaborators code to your codebase
without having conflicts
10. Git isn’t the only VCS out there…
• Mercurial
• SVN - SubVersioN
• Perforce
• BitKeeper
but (we think) it’s the best!
12. • Created by Linus Torvalds in 2005
• Described by Linus as “the stupid content tracker”
• Originally created for the development of Linux kernel
• It’s written in C, Shell, Perl, Tcl, and Python
• Currently maintained by Junio Hamano since 2005
14. • Snapshots:
• The way git tracks your codes and files history
• Records what your files look like overtime
• Commits:
• The act of creating a snapshot
• A whole git repository is made up of commits
• It contains 3 things:
• A hash code name which looks like this:
c456ae92da8e5fc1eec1587b278d37ed5d3baa04
• Information about how files and code changes
• A reference to the commit that came before it. Called a parent commit
16. • Repositories:
• A home for your files and their history of changes overtime
• Basically consists of all your commits and branches
• Can live on your local machine and/or on the cloud such as Github.
• Branches:
• Default branch is called the “master”
• A place where your unfinished features/modules lives before going
to master branch
• Contains a snapshot, history, and metadata of all your files
20. • init
• Used to initialize a git repository from an existing directory of files.
• $ git init
• clone
• Used to get a copy of a project to your local machine
• $ git clone <repo url>
• status
• Used to view the status and changes of the directory and you’re working on and the
staging area.
• $ git status
• add
• Used to add files and directories to git staging area before you can commit them
• $ git add .
• $ git add <filename>
21. • commit
• Used to record a snapshot of git’s staging area
• $ git commit -m “Here is my commit message”
• reset
• Used to undo all changes and commits
• $ git reset
• pull
• Used to fetch files from remote repo (Github) and try to merge with your current branch
• $ git pull
• $ git pull origin <branch_name>
• push
• Used to push new branches and data in staging area to remote repo (Github)
• $ git push
• $ git push origin <branch_name>
22. • branch
• Used to create, manage, and list branches
• $ git branch
• $ git branch <branch_name>
• checkout
• Used to switch from branch to branch
• $ git checkout <branch_name>
• $ git checkout -b <branch_name>
• merge
• Used to merge a branch into your current branch
• $ git merge <branch_name>
• log
• Used to show the commit history of your current breach
• $ git log
26. • Where do we store our repositories?
• Too many missing features in git (forking, pull requests,
security and privacy)
• Need to use third-party tool to document projects
• Git is a command-line tool
• Non-existent GUI and poor UX
The problem