git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65....
TRANSCRIPT
![Page 1: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/1.jpg)
Git from the inside out
![Page 2: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/2.jpg)
Talk structure
![Page 3: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/3.jpg)
Git is a graph
![Page 4: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/4.jpg)
Git is a graph
This graph dictates Git’s behaviour
![Page 5: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/5.jpg)
Git is a graph
If you understand this graph, you understand Git
![Page 6: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/6.jpg)
Run Git commands on a repository
![Page 7: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/7.jpg)
Observe how those commands change the graph
![Page 8: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/8.jpg)
Create a project
![Page 9: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/9.jpg)
Create a project ~ $ mkdir alpha
![Page 10: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/10.jpg)
Create a project ~ $ mkdir alpha ~ $ cd alpha ~/alpha $
![Page 11: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/11.jpg)
Create data directory
~/alpha $ mkdir data
![Page 12: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/12.jpg)
Create data/letter.txt
~/alpha $ mkdir data ~/alpha $ printf 'a' > data/letter.txt
![Page 13: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/13.jpg)
Project layout
~/alpha $ tree alpha !"" data !"" letter.txt
![Page 14: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/14.jpg)
Initialize the repository
![Page 15: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/15.jpg)
Initialize the repository ~/alpha $ git init Initialized repository
![Page 16: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/16.jpg)
File layout ~/alpha $ git init Initialized repository ~/alpha $ tree -a alpha !"" data !"" letter.txt
![Page 17: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/17.jpg)
File layout ~/alpha $ git init Initialized repository ~/alpha $ tree -a alpha #"" data | !"" letter.txt !"" .git !"" objects etc...
![Page 18: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/18.jpg)
Add a new file to Git
![Page 19: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/19.jpg)
Add data/letter.txt to Git
~/alpha $ git add data/letter.txt
![Page 20: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/20.jpg)
1. Create a blob object ~/alpha $ git add data/letter.txt ~/alpha $ tree -a .git .git !"" objects !"" 2e !"" 65
![Page 21: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/21.jpg)
Hashes
![Page 22: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/22.jpg)
Hash of data/letter.txt content
~/alpha $ git hash-object data/letter.txt 2e65
![Page 23: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/23.jpg)
1. Create a blob object ~/alpha $ git add data/letter.txt ~/alpha $ tree -a .git .git !"" objects !"" 2e !"" 65
~/alpha $ git hash-object data/letter.txt 2e65
![Page 24: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/24.jpg)
1. Create a blob object ~/alpha $ git add data/letter.txt ~/alpha $ tree -a .git .git !"" objects !"" 2e !"" 65 ~/alpha $ cat .git/objects/2e/65 xK??OR0dH
![Page 25: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/25.jpg)
1. Create a blob object ~/alpha $ git add data/letter.txt ~/alpha $ tree -a .git .git !"" objects !"" 2e !"" 65 ~/alpha $ cat .git/objects/2e/65 xK??OR0dH ~/alpha $ git cat-file -p 2e65 a
![Page 26: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/26.jpg)
2. Make an entry in the index ~/alpha $ git add data/letter.txt - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ cat .git/index ?H?u.data/letter.txtd
![Page 27: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/27.jpg)
2. Make an entry in the index ~/alpha $ git add data/letter.txt - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ cat .git/index ?H?u.data/letter.txtd ~/alpha $ git ls-files -s data/letter.txt 2e65
![Page 28: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/28.jpg)
2. Make an entry in the index ~/alpha $ git add data/letter.txt - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ cat .git/index ?H?u.data/letter.txtd ~/alpha $ git ls-files -s data/letter.txt 2e65
![Page 29: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/29.jpg)
Re-add a file to a repository
![Page 30: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/30.jpg)
After data/letter.txt added
a
index
a workingcopy
data/letter.txtdata/letter.txt
![Page 31: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/31.jpg)
Create data/number.txt
~/alpha $ printf '1234' > data/number.txt
![Page 32: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/32.jpg)
Create data/number.txt
~/alpha $ printf '1234' > data/number.txt
a
index
1234
a workingcopy
data/letter.txtdata/letter.txt
data/number.txt
![Page 33: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/33.jpg)
Add data/number.txt
~/alpha $ git add data/number.txt
a
index
1234
a workingcopy
data/letter.txt
data/number.txt
data/letter.txt
data/number.txt 1234
![Page 34: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/34.jpg)
Edit data/number.txt
~/alpha $ printf '1' > data/number.txt
a
index
1
a workingcopy
data/letter.txt
data/number.txt
data/letter.txt
data/number.txt 1234
![Page 35: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/35.jpg)
Add data/number.txt
~/alpha $ printf '1' > data/number.txt ~/alpha $ git add data/number.txt
a
index
1
a workingcopy
data/letter.txt
data/number.txt
data/letter.txt
data/number.txt 1
1234
![Page 36: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/36.jpg)
Make a commit
![Page 37: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/37.jpg)
Make a commit ~/alpha $ git commit -m 'a1' master 774b
![Page 38: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/38.jpg)
Before the commit
a 1
![Page 39: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/39.jpg)
1. Make a tree graph of the contents of the index ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 0eed blob 2e65 letter.txt blob 56a6 number.txt
a 1
![Page 40: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/40.jpg)
1. Make a tree graph of the contents of the index ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 0eed blob 2e65 letter.txt blob 56a6 number.txt
a 1
![Page 41: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/41.jpg)
1. Make a tree graph of the contents of the index ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 0eed blob 2e65 letter.txt blob 56a6 number.txt
a 1
![Page 42: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/42.jpg)
1. Make a tree graph of the contents of the index ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 0eed blob 2e65 letter.txt blob 56a6 number.txt
a 1
![Page 43: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/43.jpg)
1. Make a tree graph of the contents of the index ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 0eed blob 2e65 letter.txt blob 56a6 number.txt
a 1
![Page 44: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/44.jpg)
1. Make a tree graph of the contents of the index ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 0eed blob 2e65 letter.txt blob 56a6 number.txt
a 1
![Page 45: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/45.jpg)
1. Make a tree graph of the contents of the index ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 0eed blob 2e65 letter.txt blob 56a6 number.txt
a 1
data
![Page 46: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/46.jpg)
1. Make a tree graph of the contents of the index ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p ffe2 tree 0eed data
a 1
data
![Page 47: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/47.jpg)
1. Make a tree graph of the contents of the index ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p ffe2 tree 0eed data
a 1
data
![Page 48: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/48.jpg)
1. Make a tree graph of the contents of the index ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p ffe2 tree 0eed data
a 1
data
![Page 49: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/49.jpg)
1. Make a tree graph of the contents of the index ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p ffe2 tree 0eed data
a 1
root
data
![Page 50: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/50.jpg)
2. Make the commit object ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 774b tree ffe2 author [email protected] 1424798436 a1
a 1
root
data
![Page 51: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/51.jpg)
2. Make the commit object ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 774b tree ffe2 author [email protected] 1424798436 a1
a 1
root
data
![Page 52: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/52.jpg)
2. Make the commit object ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 774b tree ffe2 author [email protected] 1424798436 a1
a 1
root
data
![Page 53: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/53.jpg)
2. Make the commit object ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 774b tree ffe2 author [email protected] 1424798436 a1
a 1
root
data
![Page 54: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/54.jpg)
2. Make the commit object ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 774b tree ffe2 author [email protected] 1424798436 a1
a 1
root
data
![Page 55: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/55.jpg)
2. Make the commit object ~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ git cat-file -p 774b tree ffe2 author [email protected] 1424798436 a1
a1
a 1
root
data
![Page 56: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/56.jpg)
3. Point HEAD at the new commit
~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ cat .git/HEAD ref: refs/heads/master
a1
a 1
root
data
![Page 57: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/57.jpg)
3. Point HEAD at the new commit
~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ cat .git/HEAD ref: refs/heads/master ~/alpha $ cat .git/refs/heads/master 774b
a1
a 1
root
data
![Page 58: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/58.jpg)
3. Point HEAD at the new commit
~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ cat .git/HEAD ref: refs/heads/master ~/alpha $ cat .git/refs/heads/master 774b
~/alpha $ git commit -m 'a1' master 774b
a1
a 1
root
data
![Page 59: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/59.jpg)
3. Point HEAD at the new commit
~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ cat .git/HEAD ref: refs/heads/master ~/alpha $ cat .git/refs/heads/master 774b
a1
a 1
root
data
master
![Page 60: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/60.jpg)
3. Point HEAD at the new commit
~/alpha $ git commit -m 'a1' - - - - - - - - - - - - - - - - - - - - - - - - - - ~/alpha $ cat .git/HEAD ref: refs/heads/master ~/alpha $ cat .git/refs/heads/master 774b
a1
a 1
root
data
HEAD
master
![Page 61: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/61.jpg)
Make a commit that is not the first commit
![Page 62: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/62.jpg)
After the first commit
a
1
root
data
a1
index1
a workingcopy
data/letter.txt
data/number.txt
data/letter.txt
data/number.txt
HEAD
master
![Page 63: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/63.jpg)
Edit number.txt
~/alpha $ printf '2' > data/number.txt
a
1
root
data
a1
index2
a workingcopy
data/letter.txt
data/number.txt
data/letter.txt
data/number.txt
HEAD
master
![Page 64: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/64.jpg)
Add number.txt
~/alpha $ git add data/number.txt
a
1
root
data
a1
index2
a workingcopy
data/letter.txt
data/number.txt
data/letter.txt
data/number.txt
HEAD
master
2
![Page 65: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/65.jpg)
Make a2 commit
~/alpha $ git commit -m 'a2' master f0af
![Page 66: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/66.jpg)
1. Make a tree graph of the contents of the index ~/alpha $ git commit -m 'a2' master f0af
a
1
root
data
a1
index2
a workingcopy
data/letter.txt
data/number.txt
data/letter.txt
data/number.txt
HEAD
master
2
root
data
![Page 67: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/67.jpg)
2. Create the commit object ~/alpha $ git commit -m 'a2' master f0af ~/alpha $ git cat-file -p f0af tree ce72 parent 774b author [email protected] 1424798436 a2
a
1
root
data
a1
index2
a workingcopy
data/letter.txt
data/number.txt
data/letter.txt
data/number.txt
HEAD
master
2
root
data
a2
![Page 68: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/68.jpg)
3. Point HEAD at the new commit
~/alpha $ git commit -m 'a2' master f0af
a
1
root
data
a1
index2
a workingcopy
data/letter.txt
data/number.txt
data/letter.txt
data/number.txt
HEAD
master
2
root
data
a2
![Page 69: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/69.jpg)
Content is stored as trees
a
1
root
data
a1
HEAD
master
2
root
data
a2
![Page 70: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/70.jpg)
Content is stored as trees
The objects database stores diffs
a
1
root
data
a1
HEAD
master
2
root
data
a2
![Page 71: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/71.jpg)
Each commit has a parent
a
1
root
data
a1
HEAD
master
2
root
data
a2
![Page 72: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/72.jpg)
Each commit has a parent
A repository stores the history of a project
a
1
root
data
a1
HEAD
master
2
root
data
a2
![Page 73: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/73.jpg)
Refs are entry points to the commit history
a
1
root
data
a1
HEAD
master
2
root
data
a2
![Page 74: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/74.jpg)
Refs are entry points to the commit history
Commits can be given meaningful names
a
1
root
data
a1
HEAD
master
2
root
data
a2
![Page 75: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/75.jpg)
Objects are immutable
![Page 76: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/76.jpg)
Objects are immutable
Content is edited, not deleted
![Page 77: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/77.jpg)
Refs are mutable
![Page 78: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/78.jpg)
Refs are mutable
The meaning of a ref can change
![Page 79: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/79.jpg)
Check out a commit
![Page 80: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/80.jpg)
Check out a commit ~/alpha $ git checkout f0af HEAD is detached
![Page 81: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/81.jpg)
Check out a commit ~/alpha $ git checkout f0af HEAD is detached
![Page 82: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/82.jpg)
Check out a commit ~/alpha $ git checkout f0af HEAD is detached
~/alpha $ git commit -m 'a2' master f0af
![Page 83: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/83.jpg)
1. Write the commit tree to the working copy ~/alpha $ git checkout f0af HEAD is detached
a
1
root
data
a1
index2
a workingcopy
data/letter.txt
data/number.txt
data/letter.txt
data/number.txt
HEAD
master
2
root
data
a2
![Page 84: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/84.jpg)
2. Write the commit tree to the index ~/alpha $ git checkout f0af HEAD is detached
a
1
root
data
a1
index2
a workingcopy
data/letter.txt
data/number.txt
data/letter.txt
data/number.txt
HEAD
master
2
root
data
a2
![Page 85: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/85.jpg)
3. Point HEAD at the thing that was checked out
~/alpha $ git checkout f0af HEAD is detached ~/alpha $ cat .git/HEAD f0af
![Page 86: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/86.jpg)
3. Point HEAD at the thing that was checked out
~/alpha $ git checkout f0af HEAD is detached ~/alpha $ cat .git/HEAD f0af
~/alpha $ cat .git/HEAD ref: refs/heads/master
![Page 87: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/87.jpg)
3. Point HEAD at the thing that was checked out
~/alpha $ git checkout f0af HEAD is detached ~/alpha $ cat .git/HEAD f0af
a
1
root
data
a1
HEAD
master
2
root
data
a2
![Page 88: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/88.jpg)
Make commit a3
~/alpha $ printf '3' > data/number.txt
![Page 89: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/89.jpg)
Make commit a3
~/alpha $ printf '3' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m 'a3' detached HEAD 3645
![Page 90: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/90.jpg)
Make commit a3
~/alpha $ printf '3' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m 'a3' detached HEAD 3645
![Page 91: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/91.jpg)
Make commit a3
~/alpha $ printf '3' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m 'a3' detached HEAD 3645
a
1
root
data
a1
HEAD
master
2
root
data
a2
3
root
data
a3
![Page 92: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/92.jpg)
Create a branch
![Page 93: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/93.jpg)
Create a branch ~/alpha $ git branch deputy
![Page 94: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/94.jpg)
Create a branch ~/alpha $ git branch deputy ~/alpha $ cat .git/refs/heads/deputy 3645
![Page 95: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/95.jpg)
Create a branch ~/alpha $ git branch deputy ~/alpha $ cat .git/refs/heads/deputy 3645
a
1
root
data
a1
HEAD
master
2
root
data
a2
3
root
data
a3
deputy
![Page 96: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/96.jpg)
Branches are just refs, refs are just files
![Page 97: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/97.jpg)
Branches are just refs, refs are just files
Branches are lightweight
![Page 98: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/98.jpg)
Check out a branch
![Page 99: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/99.jpg)
~/alpha $ git checkout master Switched to branch master
Check out master
![Page 100: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/100.jpg)
~/alpha $ git checkout master Switched to branch master
1. Write the commit tree to the working copy
a
1
root
data
a1
HEAD
master
2
root
data
a2
3
root
data
a3
deputy
workingcopy index
2
a
![Page 101: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/101.jpg)
~/alpha $ git checkout master Switched to branch master
2. Write the commit tree to the index
a
1
root
data
a1
HEAD
master
2
root
data
a2
3
root
data
a3
deputy
workingcopy index
2
a
![Page 102: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/102.jpg)
~/alpha $ git checkout master Switched to branch master
3. Point HEAD at the thing that was checked out
a
1
root
data
a1
HEAD
master
2
root
data
a2
3
root
data
a3
deputy
workingcopy index
2
a
![Page 103: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/103.jpg)
Merge an ancestor
![Page 104: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/104.jpg)
Check out deputy
~/alpha $ git checkout deputy Switched to branch deputy
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
etc
![Page 105: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/105.jpg)
Merge master (a2) into deputy (a3)
~/alpha $ git merge master Already up-to-date
![Page 106: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/106.jpg)
A commit is a set of changes
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
etc
![Page 107: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/107.jpg)
A commit is a set of changes
If an ancestor is merged into a descendent, Git does nothing
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
etc
![Page 108: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/108.jpg)
Merge a descendent
![Page 109: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/109.jpg)
Check out master
~/alpha $ git checkout master Switched to branch master
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
etc
![Page 110: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/110.jpg)
Merge deputy (a3) into master (a2)
~/alpha $ git merge deputy Fast-forward
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
etc
![Page 111: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/111.jpg)
A commit is a set of changes
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
etc
![Page 112: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/112.jpg)
A commit is a set of changes
If a descendent is merged into an ancestor, history is not changed but
HEAD is changed
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
etc
![Page 113: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/113.jpg)
Make commit a4 on master
~/alpha $ printf '4' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m 'a4' master 7b7b
![Page 114: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/114.jpg)
Make commit a4 on master
~/alpha $ printf '4' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m 'a4' master 7b7b
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
![Page 115: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/115.jpg)
Check out deputy
~/alpha $ git checkout deputy Switched to branch deputy
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
![Page 116: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/116.jpg)
Make commit b3 to deputy
~/alpha $ printf 'b' > data/letter.txt ~/alpha $ git add data/letter.txt ~/alpha $ git commit -m 'b3' deputy 982d
![Page 117: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/117.jpg)
Make commit b3 to deputy
~/alpha $ printf 'b' > data/letter.txt ~/alpha $ git add data/letter.txt ~/alpha $ git commit -m 'b3' deputy 982d
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3
![Page 118: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/118.jpg)
Commits can share parents
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3
![Page 119: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/119.jpg)
Commits can share parents
New lineages can be created
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3
![Page 120: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/120.jpg)
Merge two commits from different lineages
![Page 121: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/121.jpg)
Commits can have multiple parents
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3b4
![Page 122: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/122.jpg)
Commits can have multiple parents
Lineages can be joined with a merge commit
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3b4
![Page 123: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/123.jpg)
Merge master (a4) into deputy (b3)
~/alpha $ git merge master -m 'b4' Merged
![Page 124: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/124.jpg)
Merge master (a4) into deputy (b3)
~/alpha $ git merge master -m 'b4' Merged
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3b4
![Page 125: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/125.jpg)
Commits have parents
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3
![Page 126: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/126.jpg)
Commits have parents
It is possible to find the point at which two lineages diverged
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3
![Page 127: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/127.jpg)
1. Generate the diff that combines the changes made by the receiver and giver
a3a4
b3
base giverreceiver
![Page 128: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/128.jpg)
1. Generate the diff that combines the changes made by the receiver and giver
a3
a4
b3
a a
base giverreceiver
letter.txt b
![Page 129: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/129.jpg)
A merge has a base commit
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3
![Page 130: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/130.jpg)
A merge has a base commit
Git can automatically resolve the merge of a file that has changed from the base in
only the receiver or giver
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3
![Page 131: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/131.jpg)
1. Generate the diff that combines the changesmade by the receiver and giver
a3
a4
b3
a a
base giverreceiver diff
letter.txt b b
![Page 132: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/132.jpg)
1. Generate the diff that combines the changes made by the receiver and giver
a3
a4
b3
a
4
a
base giverreceiver diff
letter.txt
number.txt
b
3 3
b
![Page 133: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/133.jpg)
1. Generate the diff that combines the changes made by the receiver and giver
a3
a4
b3
a
4
a
base giverreceiver diff
4
letter.txt
number.txt
b
3 3
b
![Page 134: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/134.jpg)
2. Apply the diff to the working copy
a3
a4
b3
a
4
a
base giverreceiver diff working copy
4
letter.txt
number.txt
b
3 3
b
4
b
![Page 135: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/135.jpg)
3. Apply the diff to the index
a3
a4
b3
a
4
a
base giverreceiver diff working copy index
4
letter.txt
number.txt
b
3 3
b
4
b
4
b
![Page 136: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/136.jpg)
4. Commit the updated index ~/alpha $ git cat-file -p a2ec tree 2029 parent 982d parent 7b7b author [email protected] 1424798436 b4
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3b4
![Page 137: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/137.jpg)
5. Point HEAD at the new commit ~/alpha $ cat .git/refs/heads/deputy a2ec
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3b4
![Page 138: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/138.jpg)
Merge commits from different lineages, where the commits both
modify the same file
![Page 139: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/139.jpg)
Check out master
~/alpha $ git checkout master Switched to branch master
![Page 140: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/140.jpg)
Merge deputy into master to bring master up to date
~/alpha $ git checkout master Switched to branch master ~/alpha $ git merge deputy Fast-forward
![Page 141: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/141.jpg)
Merge deputy into master to bring master up to date
~/alpha $ git checkout master Switched to branch master ~/alpha $ git merge deputy Fast-forward
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3b4
![Page 142: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/142.jpg)
Make commit b5 to deputy
~/alpha $ git checkout deputy Switched to branch deputy ~/alpha $ printf '5' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m 'b5' deputy bd79
![Page 143: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/143.jpg)
Make commit b6 to master
~/alpha $ git checkout master Switched to branch master ~/alpha $ printf '6' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m 'b6' master 4c3c
![Page 144: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/144.jpg)
After making commits b5 and b6
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3b4
b6
b5
![Page 145: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/145.jpg)
Merge deputy (b5) into master (b6)
~/alpha $ git merge deputy Conflict in data/number.txt
![Page 146: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/146.jpg)
1. Generate the diff that combines the changes made by the receiver and giver
b4b5
b6
base giverreceiver
![Page 147: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/147.jpg)
1. Generate the diff that combines the changes made by the receiver and giver
b4
b5
b6
b b
base giverreceiver
bletter.txt
![Page 148: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/148.jpg)
1. Generate the diff that combines the changes made by the receiver and giver
b4
b5
b6
b b
base giverreceiver diff
bletter.txt
![Page 149: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/149.jpg)
1. Generate the diff that combines the changes made by the receiver and giver
b4
b5
b6
4
b
5
b
6
base giverreceiver diff
bletter.txt
number.txt
![Page 150: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/150.jpg)
1. Generate the diff that combines the changes made by the receiver and giver
b4
b5
b6
4
b
5
b
6
base giverreceiver diff
b
56
letter.txt
number.txt
![Page 151: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/151.jpg)
2. Apply the diff to the working copy
b4
b5
b6
4
b
5
b
6
base giverreceiver diff working copy
b
56 ...
letter.txt
number.txt
![Page 152: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/152.jpg)
The number.txt conflict in the working copy
<<<<<<< HEAD 6 ======= 5 >>>>>>> deputy
![Page 153: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/153.jpg)
3. Apply the diff to the index
b4
b5
b6
4
b
5
b
6
base giverreceiver diff working copy index
b
56 ... ...
letter.txt
number.txt
![Page 154: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/154.jpg)
The index before the merge
0 data/letter.txt 63d8 0 data/number.txt 62f9
![Page 155: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/155.jpg)
The index before the merge
0 data/letter.txt 63d8 0 data/number.txt 62f9
![Page 156: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/156.jpg)
The index after the merge
0 data/letter.txt 63d8 1 data/number.txt bf0d 2 data/number.txt 62f9 3 data/number.txt 7813
![Page 157: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/157.jpg)
The index after the merge
0 data/letter.txt 63d8 1 data/number.txt bf0d 2 data/number.txt 62f9 3 data/number.txt 7813
![Page 158: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/158.jpg)
The index after the merge
0 data/letter.txt 63d8 1 data/number.txt bf0d 2 data/number.txt 62f9 3 data/number.txt 7813
![Page 159: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/159.jpg)
The index after the merge
0 data/letter.txt 63d8 1 data/number.txt bf0d 2 data/number.txt 62f9 3 data/number.txt 7813
![Page 160: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/160.jpg)
4. The user resolves the conflicts in the working copy
~/alpha $ printf '11' > data/number.txt
![Page 161: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/161.jpg)
4. The user resolves the conflicts in the index
~/alpha $ printf '11' > data/number.txt ~/alpha $ git add data/number.txt
![Page 162: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/162.jpg)
The index after the conflict in number.txt was resolved
0 data/letter.txt 63d8 0 data/number.txt 9d60
![Page 163: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/163.jpg)
6. The user commits the merge ~/alpha $ git commit -m 'b11' master 251a
![Page 164: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/164.jpg)
6. The user commits the merge ~/alpha $ git commit -m 'b11' master 251a
a 1
root
data
a1
HEAD
master
2
root
data
a2 a3
deputy
a4
b3b4
b6
b5b11
![Page 165: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/165.jpg)
Remove a file
![Page 166: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/166.jpg)
After the b11 commit
a1
HEAD
master
a2 a3
deputy
a4
b3b4
b6
b5b11
b
11
root
data
working copy index11
b
![Page 167: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/167.jpg)
Remove letter.txt
~/alpha $ git rm data/letter.txt Removed data/letter.txt
![Page 168: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/168.jpg)
Remove letter.txt
~/alpha $ git rm data/letter.txt Removed data/letter.txt
a1
HEAD
master
a2 a3
deputy
a4
b3b4
b6
b5b11
b
11
root
data
working copy index11
![Page 169: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/169.jpg)
Commit the removal of letter.txt
~/alpha $ git commit -m '11' master d14c
![Page 170: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/170.jpg)
Commit the removal of data/letter.txt
~/alpha $ git commit -m '11' master d14c
a1
HEAD
master
a2 a3
deputy
a4
b3b4
b6
b5b11
b
11
root
data
working copyindex11
11
root
data
![Page 171: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/171.jpg)
Copy a repository
![Page 172: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/172.jpg)
Copy the alpha repository to the bravo directory
~/alpha $ cd .. ~ $ cp -R alpha bravo
![Page 173: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/173.jpg)
Copy the alpha repository to the bravo directory
~/alpha $ cd .. ~ $ cp -R alpha bravo ~ $ tree -a ~ #"" alpha | #"" data | | !"" number.txt | !"" .git | etc... !"" bravo #"" data | !"" number.txt !"" .git etc...
![Page 174: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/174.jpg)
Copy the alpha repository to the bravo directory
~/alpha $ cd .. ~ $ cp -R alpha bravo ~ $ tree -a ~ #"" alpha | #"" data | | !"" number.txt | !"" .git | etc... !"" bravo #"" data | !"" number.txt !"" .git etc...
![Page 175: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/175.jpg)
Copy the alpha repository to the bravo directory
~/alpha $ cd .. ~ $ cp -R alpha bravo ~ $ tree -a ~ #"" alpha | #"" data | | !"" number.txt | !"" .git | etc... !"" bravo #"" data | !"" number.txt !"" .git etc...
![Page 176: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/176.jpg)
Copy the alpha repository to the bravo directory
~/alpha $ cd .. ~ $ cp -R alpha bravo ~ $ tree -a ~ #"" alpha | #"" data | | !"" number.txt | !"" .git | etc... !"" bravo #"" data | !"" number.txt !"" .git etc...
![Page 177: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/177.jpg)
The alpha and bravo repositories
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphabravo
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
![Page 178: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/178.jpg)
Connect a repository to another repository
![Page 179: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/179.jpg)
Move to the alpha repository
~ $ cd alpha ~/alpha $
![Page 180: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/180.jpg)
Set bravo as a remote repository on alpha
~ $ cd alpha ~/alpha $ git remote add bravo ../bravo
![Page 181: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/181.jpg)
Set bravo as a remote repository on alpha
~ $ cd alpha ~/alpha $ git remote add bravo ../bravo
![Page 182: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/182.jpg)
Set bravo as a remote repository on alpha
~ $ cd alpha ~/alpha $ git remote add bravo ../bravo
![Page 183: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/183.jpg)
Set bravo as a remote repository on alpha
~ $ cd alpha ~/alpha $ git remote add bravo ../bravo ~/alpha $ cat .git/config remote bravo url = ../bravo
![Page 184: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/184.jpg)
Fetch a branch from a remote repository
![Page 185: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/185.jpg)
Move to the bravo repository
~/alpha $ cd ../bravo ~/bravo $
![Page 186: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/186.jpg)
Set number.txt to '12' and commit
~/alpha $ cd ../bravo ~/bravo $ printf '12' > data/number.txt ~/bravo $ git add data/number.txt ~/bravo $ git commit -m '12' master 94cd
![Page 187: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/187.jpg)
After the 12 commit made to bravo
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphabravo
12
data
12
root
data
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
![Page 188: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/188.jpg)
Move to the alpha repository
~/bravo $ cd ../alpha ~/alpha $
![Page 189: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/189.jpg)
Fetch master from bravo into alpha
~/bravo $ cd ../alpha ~/alpha $ git fetch bravo master Fetching objects master -> FETCH_HEAD
![Page 190: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/190.jpg)
1. Find the HEAD commit on the repository being fetched
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphabravo
12
data
12
root
data
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
![Page 191: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/191.jpg)
2. Copy to the fetching repository the HEAD commit and its dependent objects
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphabravo
12
data
12
root
data
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
12
data
12
root
data
![Page 192: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/192.jpg)
3. Point the ref for the remote branch at the fetched commit
~/alpha $ cat .git/refs/remotes/bravo/master 94cd
![Page 193: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/193.jpg)
3. Point the ref for the remote branch at the fetched commit
~/alpha $ cat .git/refs/remotes/bravo/master 94cd
![Page 194: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/194.jpg)
3. Point the ref for the remote branch at the fetched commit
~/alpha $ cat .git/refs/remotes/bravo/master 94cd
![Page 195: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/195.jpg)
3. Point the ref for the remote branch at the fetched commit
~/alpha $ cat .git/refs/remotes/bravo/master 94cd
![Page 196: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/196.jpg)
3. Point the ref for the remote branch at the fetched commit
~/alpha $ cat .git/refs/remotes/bravo/master 94cd
![Page 197: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/197.jpg)
3. Point the ref for the remote branch at the fetched commit
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphabravo
12
data
12
root
data
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
12
data
12
root
data
bravo/master
![Page 198: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/198.jpg)
4. Point FETCH_HEAD at the fetched commit
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphabravo
12
data
12
root
data
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
12
data
12
root
data
bravo/master
FETCH_HEAD
![Page 199: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/199.jpg)
~/alpha $ cat .git/FETCH_HEAD master on bravo 94cd
4. Point FETCH_HEAD at the fetched commit
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphabravo
12
data
12
root
data
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
12
data
12
root
data
bravo/master
FETCH_HEAD
![Page 200: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/200.jpg)
Objects can be copied
![Page 201: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/201.jpg)
Objects can be copied
History can be shared between repositories
![Page 202: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/202.jpg)
Repositories store remote refs
![Page 203: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/203.jpg)
Repositories store remote refs
A repository can record locally the state of a branch on a remote repository
![Page 204: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/204.jpg)
Merge FETCH_HEAD
![Page 205: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/205.jpg)
Merge FETCH_HEAD
~/alpha $ git merge FETCH_HEAD Fast-forward
![Page 206: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/206.jpg)
Before merging FETCH_HEAD
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphabravo
12
data
12
root
data
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
12
data
12
root
data
bravo/master
FETCH_HEAD
![Page 207: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/207.jpg)
After merging FETCH_HEAD
~/alpha $ git merge FETCH_HEAD Fast-forward
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphabravo
12
data
12
root
data
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
12
data
12
root
data
bravo/master
FETCH_HEAD
![Page 208: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/208.jpg)
Pull a branch from a remote
![Page 209: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/209.jpg)
Pull master from bravo into alpha
~/alpha $ git pull bravo master Already up-to-date
![Page 210: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/210.jpg)
Clone a repository
![Page 211: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/211.jpg)
Clone alpha to charlie
~/alpha $ cd .. ~ $ git clone alpha charlie Cloned into charlie
![Page 212: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/212.jpg)
1. Create the directory for the new repository ~/alpha $ cd .. ~ $ git clone alpha charlie Cloned into charlie ~ $ ls alpha bravo charlie
![Page 213: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/213.jpg)
2. Move into the clone’s directory ~/alpha $ cd .. ~ $ git clone alpha charlie Cloned into charlie ~ $ ls alpha bravo charlie ~ $ cd charlie ~/charlie $
![Page 214: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/214.jpg)
3. Initialize the clone’s directory as a Git repository ~/alpha $ cd .. ~ $ git clone alpha charlie Cloned into charlie ~ $ ls alpha bravo charlie ~ $ cd charlie ~/charlie $ tree .git !"" objects etc...
![Page 215: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/215.jpg)
4. Check out the branch that was checked out on the repository being cloned
~/alpha $ cd .. ~ $ git clone alpha charlie Cloned into charlie - - - - - - - - - - - - - - - - - - - - - - - - - - ~/charlie $ cat .git/HEAD ref: refs/heads/master
![Page 216: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/216.jpg)
5. Pull the branch that was checked out on the repository being cloned
~/alpha $ cd .. ~ $ git clone alpha charlie Cloned into charlie - - - - - - - - - - - - - - - - - - - - - - - - - - ~/charlie $ cat .git/HEAD ref: refs/heads/master ~/charlie $ cat .git/refs/heads/master 94cd
![Page 217: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/217.jpg)
Move into alpha
~/charlie $ cd ../alpha ~/alpha $
![Page 218: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/218.jpg)
Set number.txt to '13' and commit to master
~/charlie $ cd ../alpha ~/alpha $ printf '13' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m '13' master 3238
![Page 219: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/219.jpg)
Set charlie as a remoterepository on alpha
~/charlie $ cd ../alpha ~/alpha $ printf '13' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m '13' master 3238 ~/alpha $ git remote add charlie ../charlie
![Page 220: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/220.jpg)
Push master to charlie
~/charlie $ cd ../alpha ~/alpha $ printf '13' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m '13' master 3238 ~/alpha $ git remote add charlie ../charlie ~/alpha $ git push charlie master Writing objects. Refusing to update the checked out branch because it will make the index and working copy inconsistent
![Page 221: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/221.jpg)
Before the push
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphacharlie
12a4
a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
12
data
13
root
data
13
![Page 222: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/222.jpg)
After the push
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphacharlie
12a4
a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
12
data
13
root
data
13
data
13
root
data
13
![Page 223: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/223.jpg)
Push master to charlie
~/charlie $ cd ../alpha ~/alpha $ printf '13' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m '13' master 3238 ~/alpha $ git remote add charlie ../charlie ~/alpha $ git push charlie master Writing objects. Refusing to update the checked out branch because it will make the index and working copy inconsistent
![Page 224: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/224.jpg)
Push master to charlie
~/charlie $ cd ../alpha ~/alpha $ printf '13' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m '13' master 3238 ~/alpha $ git remote add charlie ../charlie ~/alpha $ git push charlie master Writing objects. Refusing to update the checked out branch because it will make the index and working copy inconsistent
![Page 225: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/225.jpg)
Clone a bare repository
![Page 226: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/226.jpg)
Clone alpha to bare repository delta
~/alpha $ cd .. ~ $ git clone alpha delta --bare Cloning into bare repository delta
![Page 227: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/227.jpg)
File layout of delta
~/alpha $ cd .. ~ $ git clone alpha delta --bare Cloning into bare repository delta ~ $ tree delta delta #"" config !"" objects etc...
![Page 228: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/228.jpg)
The alpha and delta repositories
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphadelta
12a4
a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
12 13
13
![Page 229: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/229.jpg)
Move into alpha
~ $ cd alpha ~/alpha $
![Page 230: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/230.jpg)
Set delta as a remote repository on alpha
~ $ cd alpha ~/alpha $ git remote add delta ../delta
![Page 231: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/231.jpg)
Set number.txt to '14' and commit
~ $ cd alpha ~/alpha $ git remote add delta ../delta ~/alpha $ printf '14' > data/number.txt ~/alpha $ git add data/number.txt ~/alpha $ git commit -m '14' master cb51
![Page 232: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/232.jpg)
After the 14 commit made to alpha
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphadelta
12a4
a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
12 13
13
data
14
root
data
14
![Page 233: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/233.jpg)
Push master to delta
~/alpha $ git push delta master Writing objects To ../delta 3238..cb51 master
![Page 234: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/234.jpg)
1. Copy the commit at HEAD and its dependent objects to the remote repository
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphadelta
12a4
a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
12 13
13
data
14
root
data
14
data
14
root
data
14
![Page 235: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/235.jpg)
2. Point HEAD on the remote to the pushed HEAD commit
a4a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
alphadelta
12a4
a1 a3a2
HEAD
masterdeputy
b3b4
b6
b5b11 11
12 13
13
data
14
root
data
14
data
14
root
data
14
![Page 236: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/236.jpg)
Phew
![Page 237: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/237.jpg)
Git is a graph
![Page 238: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/238.jpg)
Git is a graph
This graph dictates Git’s behaviour
![Page 239: git from the inside out 2 - maryrosecook.com · ~/alpha $ git ls-files -s data/letter.txt 2e65. Re-add a file to a repository. After data/letter.txt added a index a working](https://reader033.vdocuments.us/reader033/viewer/2022050214/5f60713620bc2f607f61886d/html5/thumbnails/239.jpg)
Git is a graph
If you understand this graph, you understand Git