Download for free: https://git-scm.com/book/en/v2
Authors:
Scott Chacon,
Ben Straub
$ git init
Initialized empty Git repository in {PATH}/.git/
Initialize a new Git repository
$ tree .git
.git
├── branches
├── config
├── description
├── HEAD
├── hooks
│ ├── applypatch-msg.sample
│ ├── commit-msg.sample
│ ├── ...
│ ├── pre-receive.sample
│ └── update.sample
├── info
│ └── exclude
├── objects
│ ├── info
│ └── pack
└── refs
├── heads
└── tags
$ vim testing_blob.py
What is a Git object?
# file: testing_blob.py
print("Hello world from Git")
$ git hash-object -w testing_blob.py
5eefe3945ef60476ef9a4f37f4f3d653ef2316fe
.git
├── branches
├── config
├── description
├── HEAD
├── hooks
│ ├── applypatch-msg.sample
│ ├── commit-msg.sample
| ├── ...
│ ├── pre-receive.sample
│ └── update.sample
├── info
│ └── exclude
├── objects
│ ├── 5e
│ │ └── efe3945ef60476ef9a4f37f4f3d653ef2316fe
│ ├── info
│ └── pack
└── refs
├── heads
└── tags
$ git cat-file -p 5eefe3945ef60476ef9a4f37f4f3d653ef2316fe
print("Hello world from Git")
$ git cat-file -t 5eefe3945ef60476ef9a4f37f4f3d653ef2316fe
blob
Discovering the git object
Retrieving the content
"Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency".
definition taken from https://git-scm.com/
Control Version System
Did you...
controlled the versions using the filename?
my_awesome_project.zip
my_awesome_project2.zip
my_awesome_project_final_version.zip
my_not_awesome_project.zip
my_awesome_este_si_es.zip
my_awesome_rosita_de_guadalupe.zip
Control Version System
Did you...
wanna see a before version of you project?
BUT, YOU CAN'T!
Control Version System
Did you...
lost files and didn't have backup?
Control Version System
Did you...
share your project using Email, Drive, Whatsapp, etc?
Control Version System
- From Scott and Ben
Your project
Working directory/area
index
staging area
Your branch
Working branch
? ? ?
? ? ?
committed
modified
staged
Your file is...
You are in...
# Local (or project) scope
$ git config user.name “Jorge Rios”
$ git config user.email “jrios@bevertec.com”
# Global scope
$ git config --global user.name “Jorge Rios”
$ git config --global user.email “jrios@bevertec.com”
$ git config --list
$ git init
Initialized empty Git repository in {PATH}/.git/
$ git add --all
$ git commit -m "Add the next text"
$ git status
Your project
Working directory/area
index
staging area
Your branch
Working branch
git add
You are in...
git commit
Your project
Working directory/area
index
staging area
Your branch
Working branch
git add
You are in...
git commit
origin/master
origin
Remote repository
git push
Your project
Working directory/area
index
staging area
Your branch
Working branch
You are in...
origin/master
origin
Remote repository
git pull
$ git diff
$ git commit -- {file}
See my changes
Unmodifying a modified file in the working directory
$ git reset HEAD -- {file}
Revert staged changes
$ git checkout -b feature/blizzard-logo
$ git checkout feature/blizzard-logo
$ git branch -d feature/blizzard-logo
Create a new branch
Use a branch
Delete a branch
Get for free from https://education.github.com/pack