Who invented Git?
Why is it called
"the stupid content tracker”
Linus Torvalds has quipped about
the name "git", which is British English
slang for a stupid or unpleasant person:
"I'm an egotistical bastard, and
I name all my projects after myself. First
Linux, now git."
(Note that Torvalds did not in fact name
Central vs Distributed VCS
CENTRAL VCS DISTRIBUTED VCS
Each can act as a serverthe dev team only interacts with the main server
You can start a repository at any time on your
Commit history is stored locally
Redundancy - each working copy effectively
functions as a remote backup
How Git stores data?
• most other systems store information as a
list of file-based changes
• Git thinks of its data more like a set of
snapshots of a miniature filesystem
• Every time you commit, or save the state of
your project in Git
• Git thinks about its data more like a stream
• Git tracks files not folders
states of files
stored in local
changed but not
marked to go
into next commit
1. Install Git on Windows
◦ Download and run installer
2. Install Git on Mac
◦ Type in terminal: git version
3. Configure Git
◦ git config –-global user.name “Your Name”
◦ git config --global user.email “firstname.lastname@example.org”
4. Create local repository
◦ git init
→ Open terminal
→ Create a location for the lab
→ Create a repository
git init git-101
Create a file README.md
git add README.md
git commit –m “My first commit”
git commit –am “My second
Backing out changes
git add .
How to unstage changes?
git reset HEAD README.md
How to revert changes entirely?
git checkout -- README.md
Rename and remove a file
Create a file example.txt
git add example.txt
git commit -m "adding example file"
git mv example.txt demo.txt
git commit -m "renaming example”
git rm demo.txt
git commit -m ”removing demo”
git init <repo-name>
git add <file1-name> <file2-name>
git commit -m "<Messgae>”
git mv <fil1> <file2>
git rm <file1>
Work with remotes
Create Pull Request
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.
n 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper.
In 2005 the Linux kernel community faced a daunting challenge: They could no longer use their revision control system BitKeeper and no other Source Control Management (SCMs) met their needs for a distributed system. Linus Torvalds, the creator of Linux, took the challenge into his own hands and disappeared over the weekend to emerge the following week with Git. Today Git is used for thousands of projects and has ushered in a new level of social coding among programmers.
The limitations here are that you always need to have the latest code on your local repository, and to see the history of changes you will need to ask the server for that information.
You also always need to be able to access the remote repository to commit
Instead of just having one central repository that you send changes to, every committer has their own repository that has the entire commit history of the project. You don't need to connect to a remote repository, the change is just recorded on your local repository. You can still push to a centralised repository but you don't need to.
One big benefit of this is that you can start a repository at any time on your local computer.
Another big benefit (perhaps less so with cloud computing now) is redundancy. If one copy of the repository is lost for whatever reason, any of the other repositories will contain the complete history so you could only potentially lose any work since your last push.
This is an important distinction between Git and nearly all other VCSs. It makes Git reconsider almost every aspect of version control that most other systems copied from the previous generation. This makes Git more like a mini filesystem with some incredibly powerful tools built on top of it, rather than simply a VCS.
Committed means that the data is safely stored in your local database.
Modified means that you have changed the file but have not committed it to your database yet.
Staged means that you have marked a modified file in its current version to go into your next commit snapshot.
The Git directory is where Git stores the metadata and object database for your project. This is the most important part of Git, and it is what is copied when you clone a repository from another computer.
The working tree is a single checkout of one version of the project. These files are pulled out of the compressed database in the Git directory and placed on disk for you to use or modify.
The staging area is a file, generally contained in your Git directory, that stores information about what will go into your next commit. It’s sometimes referred to as the “index”, but it’s also common to refer to it as the staging area.
git config --global core.editor "sublime”