This document provides an overview of version control systems and compares Git and SVN. It discusses why version control is useful, describes popular version control systems from the past and present, and highlights key differences between distributed (Git) and centralized (SVN) systems. The document also includes instructions for downloading, setting up, and using basic Git functions for managing a code repository, including commands for saving changes, inspecting history, undoing edits, syncing repositories, and working with branches.
4. GIT vs SVN
GIT
Distributed version control system.
Lot of local Repos.
Diff is deltas (fast).
Fast local operations.
Fast remote operations.
Internet connection needed only for push/pull.
SVN
Centralized revision control system.
One central repo.
Diff is files (slow).
Slow local operations.
Slow remote operations.
Depends on internet connections.
Depends on central repo.
7. Download & Install GIT
On Windows
https://git-for-windows.github.io/
On Linux / Mac
http://www.alexgirard.com/git-book/commencement/installer-git/
8. Setting Up a Repository
The git init command creates a new Git repository.
9. Setting Up a Repository
git clone is primarily used to point to an existing repo and
make a clone or copy of that repo at in a new directory, at
another location.
10. Setting Up a Repository
The git config command is a convenience function that is
used to set Git configuration values on a global or local
project level.
11. Saving Changes
The git add command adds a change in the working
directory to the staging area.
12. Saving Changes
The git stash command takes your uncommitted changes
(both staged and unstaged), saves them away for later use,
and then reverts them from your working copy.
13. Inspecting a Depository
The git status command displays the state of the
working directory and the staging area.
14. Inspecting a Depository
The git log command displays committed snapshots. It lets
you list the project history, filter it, and search for specific
changes.
15. Undoing Changes
The git checkout command serves three distinct functions:
checking out files, checking out commits, and checking out
branches.
16. Undoing Changes
The git revert command undoes a committed snapshot. But,
instead of removing the commit from the project history, it
generate a new commit that undoes all of the changes
17. Undoing Changes
git reset is a versatile command with many configurations. It can be
used to remove committed snapshots, although its more often used
to undo changes in the staging area and the working directory.
18. Undoing Changes
The git clean command removes untracked files from
your working directory.
19. Rewriting History
The git commit --amend command is a convenient way to fix up the
most recent commit. It lets you combine staged changes with the
previous commit instead of committing it as an entirely new
snapshot.
20. Rewriting History
The git rebase command allows you to easily change a
series of commits, modifying the history of your repository.
You can reorder, edit, or squash commits.
21. Syncing
The git remote command lets you create, view, and
delete connections to other repositories.
22. Syncing
The git fetch command imports commits from a
remote repository into your local repo
23. Syncing
git pull runs git fetch with the given parameters and calls
git merge to merge the retrieved branch heads into the
current branch.
24. Syncing
Use git push to push commits made on your local
branch to a remote repository.