GitIntro+GettingGit+GitStartedwithGit 2ndPart
GitIntro+GettingGit+GitStartedwithGit 2ndPart
branch
C1
branches
• Easy to switch
master
Commit
98ca9
c3d README.txt
f13 hello.c
#include<stdio.h>
This is Scott's
Hello project.
int main(void) {
printf("Hello\n");
Licensed under
return 0;
GPL.
}
HEAD
master
Commit
98ca9
c3d README.txt
f13 hello.c
#include<stdio.h>
This is Scott's
Hello project.
int main(void) {
printf("Hello\n");
Licensed under
return 0;
GPL.
}
HEAD
master
Commit
98ca9
c3d README.txt
f13 hello.c
#include<stdio.h>
This is Scott's
Hello project.
int main(void) {
printf("Hello\n");
Licensed under
return 0;
GPL.
}
HEAD
master
Commit
98ca9
c3d README.txt
f13 hello.c
#include<stdio.h>
This is Scott's
Hello project.
int main(void) {
printf("Hello\n");
Licensed under
return 0;
GPL.
}
git branch i18n
HEAD
master
Commit
98ca9
98ca9
c3d README.txt
f13 hello.c
i18n
#include<stdio.h>
This is Scott's
Hello project.
int main(void) {
printf("Hello\n");
Licensed under
return 0;
GPL.
}
git branch i18n
HEAD
master
Commit
98ca9
98ca9
c3d README.txt
f13 hello.c
i18n
#include<stdio.h>
This is Scott's
Hello project.
int main(void) {
printf("Hello\n");
Licensed under
return 0;
GPL.
}
git branch
HEAD
master
Commit
98ca9
98ca9
c3d README.txt
f13 hello.c
i18n
#include<stdio.h>
This is Scott's
Hello project.
int main(void) {
printf("Hello\n");
Licensed under
return 0;
GPL.
}
git branch
HEAD
$ git branch
* master
master
i18n
Commit
98ca9
98ca9
c3d README.txt
f13 hello.c
i18n
#include<stdio.h>
This is Scott's
Hello project.
int main(void) {
printf("Hello\n");
Licensed under
return 0;
GPL.
}
$ f i nd . gi t / r ef s
. gi t / r ef s
. gi t / r ef s/ heads
. gi t / r ef s/ heads/ def aul t
. gi t / r ef s/ heads/ exper i ment
$ f i nd . gi t / r ef s
. gi t / r ef s
. gi t / r ef s/ heads
. gi t / r ef s/ heads/ mast er
. gi t / r ef s/ heads/ i 18n
$ f i nd . gi t / r ef s
. gi t / r ef s
. gi t / r ef s/ heads
. gi t / r ef s/ heads/ mast er
. gi t / r ef s/ heads/ i 18n
master
98ca9
a23fe
i18n
HEAD
git checkout i18n
HEAD
master
98ca9
a23fe
i18n
HEAD
HEAD
master
98ca9
a23fe
i18n
HEAD
git commit
HEAD
master
98ca9
a23fe
i18n
HEAD
git commit
HEAD
master
98ca9
a23fe
i18n
HEAD
git commit
master
98ca9
a23fe
i18n
HEAD
master
98ca9
a23fe
i18n
HEAD
git commit
master
98ca9
a23fe
i18n
HEAD
git commit
master
98ca9
a23fe 3acd1
i18n
HEAD
master
98ca9
a23fe 3acd1
i18n
HEAD
git checkout -b iss53 master
master
98ca9
a23fe 3acd1
i18n
HEAD
git checkout -b iss53 master
master
98ca9
a23fe 3acd1
iss53
i18n
HEAD
git checkout master;
git checkout -b iss53
master
98ca9
a23fe 3acd1
iss53
i18n
HEAD
git checkout master;
git branch iss53;
git checkout iss53
master
98ca9
a23fe 3acd1
iss53
i18n
HEAD
git checkout -b iss53 master
master
98ca9
a23fe 3acd1
iss53
i18n
HEAD
master
98ca9
a23fe 3acd1
iss53
i18n
HEAD
git commit
HEAD
iss53
master
34ac2
98ca9
a23fe 3acd1
i18n
HEAD
iss53
master
34ac2
98ca9
a23fe 3acd1
i18n
git commit
HEAD
iss53
master
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
HEAD
iss53
master
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
HEAD
iss53
master
c3d98ca9
README.txt
f13 hello.c
c3da23fe
README.txt c3d README.txt
f13 hello.c 9ec3acd1
hello.c
d3a i18n.c 3a6 i18n.c
i18n
HEAD
iss53
master
c3d98ca9
README.txt
f13 hello.c
c3da23fe
README.txt c3d README.txt
f13 hello.c 9ec3acd1
hello.c
d3a i18n.c 3a6 i18n.c
i18n
HEAD
iss53
master
c3d98ca9
README.txt
f13 hello.c
c3da23fe
README.txt c3d README.txt
f13 hello.c 9ec3acd1
hello.c
d3a i18n.c 3a6 i18n.c
i18n
HEAD
iss53
master
c3d98ca9
README.txt
f13 hello.c
c3da23fe
README.txt c3d README.txt
f13 hello.c 9ec3acd1
hello.c
d3a i18n.c 3a6 i18n.c
i18n
HEAD
iss53
master
c3d98ca9
README.txt
f13 hello.c
c3da23fe
README.txt c3d README.txt
f13 hello.c 9ec3acd1
hello.c
d3a i18n.c 3a6 i18n.c
i18n
HEAD
iss53
master
c3d98ca9
README.txt
f13 hello.c
c3da23fe
README.txt c3d README.txt
f13 hello.c 9ec3acd1
hello.c
d3a i18n.c 3a6 i18n.c
i18n
HEAD
iss53
master
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
merging
gi t mer ge
HEAD
iss53
master
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
git checkout master
HEAD
iss53
master
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
git merge iss53
HEAD
iss53
master
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
git merge iss53
HEAD
iss53
master
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
fast-forward merge
git merge iss53
HEAD
iss53
master
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
git merge iss53
HEAD
master iss53
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
HEAD
master iss53
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
git merge i18n
HEAD
master iss53
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
non fast-forward merge
git merge i18n
HEAD
master iss53
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
git merge i18n
HEAD
master iss53
34ac2 f30ab
98ca9
a23fe 3acd1
i18n
git merge i18n
HEAD
master iss53
c3d README.txt
34ac2 f13 f30ab
hello.c
5ff issue.c
c3d README.txt
f13 98ca9
hello.c
c3d README.txt
a23fe 9ec 3acd1
hello.c
3a6 i18n.c
i18n
git merge i18n
HEAD
master iss53
c3d README.txt
34ac2 f13 f30ab
hello.c
5ff issue.c
c3d README.txt
f13 98ca9
hello.c
c3d README.txt
a23fe 9ec 3acd1
hello.c
3a6 i18n.c
i18n
git merge i18n
HEAD
master iss53
c3d README.txt
34ac2 f13 f30ab
hello.c
5ff issue.c
c3d README.txt
f13 98ca9
hello.c
c3d README.txt
a23fe 9ec 3acd1
hello.c
3a6 i18n.c
i18n
git merge i18n
HEAD
master iss53
c3d README.txt
34ac2 f13 f30ab
hello.c
5ff issue.c
c3d README.txt
f13 98ca9
hello.c
c3d README.txt
a23fe 9ec 3acd1
hello.c
3a6 i18n.c
i18n
git merge i18n
HEAD
master iss53
c3d README.txt
c3d README.txt
9ec hello.c
34ac2 f13 f30ab
hello.c
5ff 95c41
issue.c
5ff issue.c
3a6 i18n.c
c3d README.txt
f13 98ca9
hello.c
c3d README.txt
a23fe 9ec 3acd1
hello.c
3a6 i18n.c
i18n
git merge i18n
HEAD
iss53 master
c3d README.txt
c3d README.txt
9ec hello.c
34ac2 f13 f30ab
hello.c
5ff 95c41
issue.c
5ff issue.c
3a6 i18n.c
c3d README.txt
f13 98ca9
hello.c
c3d README.txt
a23fe 9ec 3acd1
hello.c
3a6 i18n.c
i18n
HEAD
iss53 master
c3d README.txt
c3d README.txt
9ec hello.c
34ac2 f13 f30ab
hello.c
5ff 95c41
issue.c
5ff issue.c
3a6 i18n.c
c3d README.txt
f13 98ca9
hello.c
c3d README.txt
a23fe 9ec 3acd1
hello.c
3a6 i18n.c
i18n
HEAD
iss53 master
c3d README.txt
c3d README.txt
9ec hello.c
34ac2 f13 f30ab
hello.c
5ff 95c41
issue.c
5ff issue.c
3a6 i18n.c
c3d README.txt
f13 98ca9
hello.c
c3d README.txt
a23fe 9ec 3acd1
hello.c
3a6 i18n.c
i18n
HEAD
iss53 master
c3d README.txt
c3d README.txt
9ec hello.c
34ac2 f13 f30ab
hello.c
5ff 95c41
issue.c
5ff issue.c
3a6 i18n.c
c3d README.txt
f13 98ca9
hello.c
c3d README.txt
a23fe 9ec 3acd1
hello.c
3a6 i18n.c
i18n
HEAD
iss53 master
c3d README.txt
c3d README.txt
9ec hello.c
34ac2 f13 f30ab
hello.c
5ff 95c41
issue.c
5ff issue.c
3a6 i18n.c
c3d README.txt
f13 98ca9
hello.c
c3d README.txt
a23fe 9ec 3acd1
hello.c
3a6 i18n.c
i18n
HEAD
iss53 master
c3d README.txt
c3d README.txt
9ec hello.c
34ac2 f13 f30ab
hello.c
5ff 95c41
issue.c
5ff issue.c
3a6 i18n.c
c3d README.txt
f13 98ca9
hello.c
c3d README.txt
a23fe 9ec 3acd1
hello.c
3a6 i18n.c
i18n
HEAD
iss53 master
c3d README.txt
c3d README.txt
9ec hello.c
34ac2 f13 f30ab
hello.c
5ff 95c41
issue.c
5ff issue.c
3a6 i18n.c
c3d README.txt
f13 98ca9
hello.c
c3d README.txt
a23fe 9ec 3acd1
hello.c
3a6 i18n.c
i18n
HEAD
iss53 master
98ca9
a23fe 3acd1
i18n
$ git commit
reintegration merges
HEAD
iss53 master
98ca9
a23fe 3acd1
i18n
git checkout i18n
iss53 master
98ca9
a23fe 3acd1
i18n
HEAD
git commit
iss53 master
98ca9
i18n
HEAD
git checkout master
HEAD
iss53 master
98ca9
i18n
git merge i18n
HEAD
iss53 master
98ca9
i18n
git merge i18n
HEAD
iss53 master
98ca9
i18n
git merge i18n
HEAD
iss53 master
c3d README.txt
9ec hello.c
34ac2 f30ab 5ff 95c41
issue.c
3a6 i18n.c
98ca9
i18n
git merge i18n
HEAD
iss53 master
c3d README.txt
9ec hello.c
34ac2 f30ab 5ff 95c41
issue.c
3a6 i18n.c
98ca9
i18n
git merge i18n
HEAD
iss53 master
c3d README.txt
9ec hello.c
34ac2 f30ab 5ff 95c41
issue.c
3a6 i18n.c
98ca9
i18n
git merge i18n
HEAD
iss53 master
c3d README.txt
9ec hello.c
34ac2 f30ab 5ff 95c41
issue.c
3a6 i18n.c
98ca9
i18n
git merge i18n
HEAD
iss53 master
98ca9
i18n
git merge i18n
HEAD
iss53 master
98ca9
i18n
git merge i18n
HEAD
iss53 master
98ca9
i18n
Why is this cool?
try out an idea
isolate work units
long running topics
long running topics
continuous merging
Deleting Branches
git branch -d branch
git branch –d iss53
git branch –d iss53
git branch –d iss53
git branch –d iss53
git branch –d i18n
---
git branch –d iss53
git branch –d i18n
git branch –D i18n
git branch –D i18n
--delete --force
using a branch
git checkout -b feature2 create new branch
merge experiment
initial state
initial state
rebase master
warning!
iss53 master
34ac2
4db9f f30ab
5eea9 95c41
16758
98ca9
79c2a
a23fe
1d638 3acd1
4b2a7 4fa23
faf4e
i18n
git log
HEAD
iss53 master
34ac2
4db9f f30ab
5eea9 95c41
16758
98ca9
79c2a
a23fe
1d638 3acd1
4b2a7 4fa23
faf4e
i18n
git log
HEAD
iss53 master
34ac2
4db9f f30ab
5eea9 95c41
16758
98ca9
79c2a
a23fe
1d638 3acd1
4b2a7 4fa23
faf4e
i18n
git log
HEAD
iss53 master
34ac2
4db9f f30ab
5eea9 95c41
16758
98ca9
79c2a
a23fe
1d638 3acd1
4b2a7 4fa23
faf4e
i18n
git log
HEAD
iss53 master
34ac2
4db9f f30ab
5eea9 95c41
16758
98ca9
79c2a
a23fe
1d638 3acd1
4b2a7 4fa23
faf4e
i18n
git log
HEAD
iss53 master
34ac2
4db9f f30ab
5eea9 95c41
16758
98ca9
79c2a
a23fe
1d638 3acd1
4b2a7 4fa23
faf4e
i18n
$ git log
commit 16758d868a4e97c9d4281940438b7ea1680cfc0a
Merge: 5eea9cf 4b2a7ae
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:29:23 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
i18n
commit 5eea9cf450d5b200d7f134e4024d1c062cb5b341
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:35 2010 -0700
commit 4db9f5c2b4c3935ff787f0fa85e9265c3e306fca
Author: Scott Chacon <[email protected]>
Date: Wed Jul 28 16:27:10 2010 -0700
iss53 master
79c2a
i18n
$ git log --oneline
16758d8 Merge branch 'i18n'
4b2a7ae fix spacing issues in both c files
1d6389c added i18n file
5eea9cf documented issue file
4db9f5c added issue file
79c2add initial project import
HEAD
iss53 master
79c2a
i18n
$ git log --oneline iss53
5eea9cf documented issue file
4db9f5c added issue file
79c2add initial project import
HEAD
iss53 master
79c2a
i18n
$ git log --oneline i18n
faf4ece update README to be more specific
4b2a7ae fix spacing issues in both c files
1d6389c added i18n file
79c2add initial project import
HEAD
iss53 master
79c2a
i18n
git log --graph
$ git log --oneline
16758d8 Merge branch 'i18n'
4b2a7ae fix spacing issues in both c files
1d6389c added i18n file
5eea9cf documented issue file
4db9f5c added issue file
79c2add initial project import
HEAD
iss53 master
79c2a
i18n
$ git log --oneline --graph
* 16758d8 Merge branch 'i18n'
|\
| * 4b2a7ae fix spacing issues in both c files
| * 1d6389c added i18n file
* | 5eea9cf documented issue file
* | 4db9f5c added issue file
|/ HEAD
* 79c2add initial project import
iss53 master
79c2a
i18n
$ git log --oneline --graph
* 16758d8 Merge branch 'i18n'
|\
| * 4b2a7ae fix spacing issues in both c files
| * 1d6389c added i18n file
* | 5eea9cf documented issue file
* | 4db9f5c added issue file
|/ HEAD
* 79c2add initial project import
iss53 master
79c2a
i18n
$ git log --oneline --graph
* 16758d8 Merge branch 'i18n'
|\
| * 4b2a7ae fix spacing issues in both c files
| * 1d6389c added i18n file
* | 5eea9cf documented issue file
* | 4db9f5c added issue file
|/ HEAD
* 79c2add initial project import
iss53 master
79c2a
i18n
$ git log --oneline --graph
* 16758d8 Merge branch 'i18n'
|\
| * 4b2a7ae fix spacing issues in both c files
| * 1d6389c added i18n file
* | 5eea9cf documented issue file
* | 4db9f5c added issue file
|/ HEAD
* 79c2add initial project import
iss53 master
79c2a
i18n
$ git log --oneline --graph
* 16758d8 Merge branch 'i18n'
|\
| * 4b2a7ae fix spacing issues in both c files
| * 1d6389c added i18n file
* | 5eea9cf documented issue file
* | 4db9f5c added issue file
|/ HEAD
* 79c2add initial project import
iss53 master
79c2a
i18n
$ git log --oneline --graph
* 16758d8 Merge branch 'i18n'
|\
| * 4b2a7ae fix spacing issues in both c files
| * 1d6389c added i18n file
* | 5eea9cf documented issue file
* | 4db9f5c added issue file
|/ HEAD
* 79c2add initial project import
iss53 master
79c2a
i18n
$ git log --oneline --graph
* 16758d8 Merge branch 'i18n'
|\
| * 4b2a7ae fix spacing issues in both c files
| * 1d6389c added i18n file
* | 5eea9cf documented issue file
* | 4db9f5c added issue file
|/ HEAD
* 79c2add initial project import
iss53 master
79c2a
i18n
git log --all
79c2a
i18n
$ git log --oneline --graph --all --decorate
* faf4ece (i18n) update README to be more specific
| * 16758d8 (HEAD, master) Merge branch 'i18n'
| |\
| |/
|/|
* | 4b2a7ae fix spacing issues in both c files
* | 1d6389c added i18n file
| * 5eea9cf (iss53) documented issue file
| * 4db9f5c added issue file HEAD
|/
* 79c2add initial project import
iss53 master
79c2a
i18n
git config --global
alias.lol “log --oneline --graph --decorate”
git config --global
alias.lol “log --oneline --graph --decorate”
git lol
git config --global
alias.lol “log --oneline --graph --decorate”
git lol
$ git lol --all
* faf4ece (i18n) update README to be more specific
| * 16758d8 (HEAD, master) Merge branch 'i18n'
| |\
| |/
|/|
* | 4b2a7ae fix spacing issues in both c files
* | 1d6389c added i18n file
| * 5eea9cf (iss53) documented issue file
| * 4db9f5c added issue file HEAD
|/
* 79c2add initial project import
iss53 master
79c2a
i18n
Review
Review
git init
Review
git init
git clone
Review
git init
git clone
git add
Review
git init
git clone
git add
git status
Review
git init
git clone
git add
git status
git commit
Review
git init
git clone
git add
git status
git commit
git branch
Review
git init git checkout
git clone
git add
git status
git commit
git branch
Review
git init git checkout
git add
git status
git commit
git branch
Review
git init git checkout
git status
git commit
git branch
Review
git init git checkout
git commit
git branch
Review
git init git checkout
git branch
Review
git init git checkout
12
git clone git merge
git-scm.com
gitref.org
progit.com
[email protected]