Agenda
• Version Control
• What
• Why
• Types
• How
• Git
• History
• Fundamentals
• Basic Commands
• Branching
• Working with remote
• Further reading/ references
• Tips
Version Control
• In computer software engineering, revision control is any kind of practice
that tracks and provides control over changes to source code.
• Version control is a system that records changes to a file or set of files over
time so that you can recall specific versions later.
https://en.wikipedia.org/wiki/Version_control
Git – History
• The Linux kernel is an open source software project of fairly large scope. For most of the lifetime of the
Linux kernel maintenance (1991–2002), changes to the software were passed around as patches and
archived files. In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper.
• In 2005, the relationship between the community that developed the Linux kernel and the commercial
company that developed BitKeeper broke down, and the tool’s free-of-charge status was revoked. This
prompted the Linux development community (and in particular Linus Torvalds, the creator of Linux) to
develop their own tool based on some of the lessons they learned while using BitKeeper.
https://git-scm.com/book/en/v2
Git - Data Storage
Storing data as changes to a base version of each file.
Storing data as snapshots of the project over time.
https://git-scm.com/book/en/v2
Git – Basic Commands
Checking status of files
$ Git status
Output On branch master nothing to commit, working directory clean
Checking status of files – Untracked files – (Add a file to working dir.)
$ Git status
Output
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
New Text Document.txt
nothing added to commit but untracked files present (use "git add" to track)
Tracking files – Add
$ git add <filename>
Output On branch master nothing to commit, working directory clean
Checking status of files – After adding file
$ git status
Output
On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage)
new file: <File Name>
Staging Modified Files (Modify a file)
If you change a previously tracked file called “CONTRIBUTING.md” and then run
your git status command again, you get something that looks like this:
$ git status
Output
Changes not staged for commit: (use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory
You have to add them again
$ git add CONTRIBUTING.md
Git – Basic Commands
Git – Basic Commands
Commit files
$ git commit
$ git commit –m
Skipping the staging area
$ git commit -a –m [applicable for tracked files]
Removing File- You have to remove it from tracked files(staging area) and then commit
$ git rm <<File name>>
$ git commit
Commit History -
$ git logs
Unstaging staged file
$ git reset HEAD CONTRIBUTING.md
Unmodifying a Modified File
$ git checkout -- CONTRIBUTING.md
Git - Further Reading
• PRO GIT (Beginner)
https://git-scm.com/book/en/v2
• Git Pocket Guide (Advanced)
http://www.amazon.in/Git-Pocket-Guide-Richard-Silverman/dp/935110236X
Git - Always Remember – git never forgets!
There are a lot of great things about Git, but one feature that can cause issues is the fact that a git clone
downloads the entire history of the project, including every version of every file.
This is fine if the whole thing is source code, because Git is highly optimized to compress that data
efficiently.
However, if someone at any point in the history of your project added a single huge file, every clone for all
time will be forced to download that large file, even if it was removed from the project in the very next
commit. Because it’s reachable from the history, it will always be there.
https://rtyley.github.io/bfg-repo-cleaner/
https://git-scm.com/book/en/v2