What the git? - SAP Inside Track Munich 2016
-
Upload
hendrik-neumann -
Category
Technology
-
view
309 -
download
1
Transcript of What the git? - SAP Inside Track Munich 2016
![Page 1: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/1.jpg)
What the Git?
Hendrik Neumann
![Page 2: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/2.jpg)
2
What the Git?
Answer in 5 steps:
1. Git and version control
2. Git internals
3. Git working
4. Git in the world of SAP
5. Git and ABAP
Agenda
![Page 3: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/3.jpg)
Version Control
![Page 4: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/4.jpg)
4
File revision hell…
Example1:
Example2:
Version Control Systems to the rescue
![Page 5: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/5.jpg)
5
Version control is a system that records
changes to a file or set of files over time so that
you can recall specific versions later.
Definition
Quelle: ProGit, 2nd edition by Chacon & Straub
![Page 6: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/6.jpg)
6
Local Computer
Local version control
Version Database
File Version 3
Version 2
Version 1
Checkout
![Page 7: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/7.jpg)
7
Source Code Control System (SCCS)
• early 1970s by M. J. Rochkind
• repository with file locking: check out with/without lock
Revision Control System (RCS)
• early 1980s by Walter F. Tichy
• forward and reverse delta concepts for the efficient storage of
different file revision
Local version control
![Page 8: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/8.jpg)
8
Centralized version control
Computer A Central VCS Server
Version Database File
Version 3
Version 2
Version 1
Computer B
File
![Page 9: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/9.jpg)
9
Concurrent Version System (CVS)
• 1986 by Dick Grune
• CVS gave each developer write permission in his or her private
working copy
• automatic merge of changes by different developers unless the
same line was changed conflict
Subversion (SVN)
• 2001
• committed changes atomically and had significantly better support
for branches
Centralized version control
![Page 10: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/10.jpg)
10
Distributed version control
Server Computer
Version Database
Version 3
Version 2
Version 1 Computer B
Version Database
Version 3
Version 2
Version 1
File
Computer A
Version Database
Version 3
Version 2
Version 1
File
![Page 11: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/11.jpg)
11
BitKeeper and Mercurial
• no central repository
• provide each developer with his own
copy
Mercurial and Monotone
• use hash fingerprints to uniquely identify
a file’s content
Distributed version control
![Page 12: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/12.jpg)
12
Linux kernel project
• 1991–2002: patches and archived files by email
• 2002: BitKeeper
• 2005: BitKeeper no longer usable free of charge
• April 2005: Linus Torvalds started Git
• Starting April 20 Linux kernel project uses Git (6,7 million lines of code!)
Git has evolved and matured to be
• easy to use
• incredibly fast
• efficient with large projects
• incredible branching system for non-linear development.
The history of Git
![Page 13: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/13.jpg)
13
Git became self-hosted on April 7 with this commit:
Git‘s birth
commit e83c5163316f89bfbde7d9ab23ca2e25604af29 Author: Linus Torvalds <[email protected]> Date: Thu Apr 7 15:13:13 2005 -0700 Initial revision of "git", the information manager from hell
![Page 14: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/14.jpg)
Git internals
![Page 15: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/15.jpg)
15
Git repository
local repository consists of
three “trees” maintained by git
Working
Directory Staging Area
.git directory
(Repository)
![Page 16: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/16.jpg)
16
Git repository
remote repositories don’t have
a working directory
Staging Area .git directory
(Repository)
![Page 17: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/17.jpg)
17
Git repository
actual files – single checkout
of one version of the project
Working
Directory
![Page 18: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/18.jpg)
18
Git repository
a file that stores the information
what will go into the next commit
Staging Area
![Page 19: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/19.jpg)
19
Git repository
a.k.a. the INDEX
Staging Area
![Page 20: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/20.jpg)
20
Git repository
metadata and object database
are stored in the directory
.git directory
(Repository)
![Page 21: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/21.jpg)
21
Basic Git workflow
git init
Working
Directory Staging Area
.git directory
(Repository)
![Page 22: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/22.jpg)
22
Working
Directory Staging Area
.git directory
(Repository)
checkout the project
Basic Git workflow
git clone
![Page 23: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/23.jpg)
23
Working
Directory Staging Area
.git directory
(Repository)
stage fixes
Basic Git workflow
git add
![Page 24: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/24.jpg)
24
Working
Directory Staging Area
.git directory
(Repository)
commit
Basic Git workflow
git commit
![Page 25: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/25.jpg)
25
Working
Directory Staging Area
.git directory
(Repository)
Commit
Checkout the project
Stage Fixes
Basic Git workflow
![Page 26: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/26.jpg)
26
Git demo
fresh initialized git repo
Live Demo
![Page 27: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/27.jpg)
27
Git demo
fresh initialized git repo
![Page 28: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/28.jpg)
28
Git demo
stage a file
![Page 29: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/29.jpg)
29
Git demo
modify a stage a file
![Page 30: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/30.jpg)
30
Git demo
commit modified file
![Page 31: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/31.jpg)
31
Unmodified Modified Staged
Stage the file
Commit
Lifecycle of a file in Git
Untracked
Edit the file
Add the file
Remove the file
![Page 32: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/32.jpg)
Working
![Page 33: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/33.jpg)
33
Classical VCS
Storing data as changes to a base
version of each file
Version 1
File A ∆1
Checkins over time
Version 2 Version 3 Version 4 Version 5
∆2
∆1 ∆2 File B
File C ∆1 ∆2 ∆2
![Page 34: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/34.jpg)
34
Git‘s way
Storing data as a snapshots of the
project over time.
Version 1
File A A1
Checkins over time
Version 2 Version 3 Version 4 Version 5
A2
B1 B2 File B
File C C1 C2 C3
A2 A1
B B
C2
![Page 35: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/35.jpg)
35
Git‘s way
If a file did not change only a link
to the file is stored
Version 1
File A A1
Checkins over time
Version 2 Version 3 Version 4 Version 5
A2
B1 B2 File B
File C C1 C2 C3
A2 A1
B B
C2
![Page 36: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/36.jpg)
36
• Everything in Git is check-summed before it is stored
• Checksum used for reference Integrity!
• All objects are stored compressed in the Git Object Database and
referenced by the SHA-1 value of its contents (plus a small header)
SHA-1 References
commit e83c5163316f89bfbde7d9ab23ca2e25604af29 Author: Linus Torvalds <[email protected]> Date: Thu Apr 7 15:13:13 2005 -0700 Initial revision of "git", the information manager from hell
![Page 37: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/37.jpg)
37
• Everything in Git is check-summed before it is stored
• Checksum used for reference Integrity!
• All objects are stored compressed in the Git Object Database and
referenced by the SHA-1 value of its contents (plus a small header)
• SHA-1 hash: 40-character hexadecimal string: 24b9da6552252987aa493b52f8696cd6d3b00373
SHA-1 References
![Page 38: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/38.jpg)
38
Git
![Page 39: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/39.jpg)
39
git add README hello.abap LICENSE
git commit -m “Initial commit”
Git commit
• One commit with pointer to the tree and
the commit metadata
• One tree: commited content & which files
are stored in which blob
• Three blobs for the content of each file
![Page 40: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/40.jpg)
40
a commit and its tree
commit
tree: 92ec2
author: Hendrik
commiter: Hendrik «Initial commit»
tree
blob: 5b1d3 README
blob: 911e7 hello.abap
blob: cba0a LICENSE
blob
Hello Munich! This is
a README file for the
project….
blob
REPORT ‘Hello’.
WRITE ‘Hello sitMUC’.
blob
BPL Agreement
Beer Public License..
911e7
5b1d3
cba0a
92ec2 98ca9
Git commit
![Page 41: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/41.jpg)
41
Git commit
commits and parents
911e7
5b1d3
cba0a
92ec2 98ca9
commit
tree: 92ec2
parent:
author: Hendrik
commiter: Hendrik Initial commit
Snapshot A
commit
tree: 184ca
parent: 98ca9
author: Hendrik
commiter: Hendrik Bug fix #4711
Snapshot B
commit
tree: 0de24
parent: 34ac2
author: Hendrik
commiter: Hendrik Feature request #007
Snapshot C
98ca9 34ac2 f30ab
![Page 42: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/42.jpg)
42
Concept of branches
![Page 43: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/43.jpg)
43
Git branch
a branch and its commit history
911e7
5b1d3
cba0a
92ec2 98ca9
98ca9
Snapchot A
34ac2
Snapchot B
f30ab
Snapchot C
v1.0 master
HEAD Tag
Pointer to a specific commit
![Page 44: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/44.jpg)
44
Git branch
git branch testing
911e7
5b1d3
cba0a 98ca9 34ac2 f30ab
testing
master
master branch
created by git init
![Page 45: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/45.jpg)
45
Git branch
HEAD points to working branch
911e7
5b1d3
cba0a 98ca9 34ac2 f30ab
testing
master
HEAD
![Page 46: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/46.jpg)
46
Git branch
git checkout testing
911e7
5b1d3
cba0a
98ca9 34ac2 f30ab
testing
master
HEAD
![Page 47: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/47.jpg)
47
Git branch
git commit –a –m ‘made a change’
911e7
5b1d3
cba0a
98ca9 34ac2 f30ab
testing
master
HEAD
87ab2
![Page 48: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/48.jpg)
48
Git branch
git checkout master
911e7
5b1d3
cba0a
98ca9 34ac2 f30ab
testing
master
87ab2
HEAD
![Page 49: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/49.jpg)
49
Git branch
git checkout master
911e7
5b1d3
cba0a
98ca9 34ac2 f30ab
testing
master
87ab2
HEAD Switching branches
changes files in your
working directory!
![Page 50: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/50.jpg)
50
Git branch
911e7
5b1d3
cba0a
C0 C1 C2
testing
master
C3
HEAD
Human Readble keys
![Page 51: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/51.jpg)
51
Git branch
commit on master new branch
911e7
5b1d3
cba0a
C0 C1 C2
testing
master
C3
HEAD
C4
![Page 52: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/52.jpg)
52
Git branche
git checkout –b hotfix
911e7
5b1d3
cba0a
C0 C1 C2
testing
master
C3
C4 C5
hotfix
![Page 53: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/53.jpg)
53
Git merge
git checkout master git merge hotfix
911e7
5b1d3
cba0a
C0 C1 C2
testing
master
C3
C4 C5
hotfix
![Page 54: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/54.jpg)
54
Git merge
git branch –d hotfix
911e7
5b1d3
cba0a
C0 C1 C2
testing
C3
C4 C5
master
![Page 55: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/55.jpg)
55
Got merge
git checkout master git merge testing
911e7
5b1d3
cba0a
C0 C1 C2
testing
C3
C4 C5
master
![Page 56: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/56.jpg)
56
Git merge
Three snapshots used in a typical merge
911e7
5b1d3
cba0a
C0 C1 C2
testing
C3
C4 C5
master
Common
Ancestor Snapshot to
Merge Into
Snapshot to
Merg In
![Page 57: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/57.jpg)
57
Git merge
A merge commit
911e7
5b1d3
cba0a
C0 C1 C2
testing
C3
C4 C5
master
C6
![Page 58: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/58.jpg)
58
Git commit consists of 2 things:
1. pointer to the state of your code at some
moment in time
2. zero or more pointers to „parent“ commits
a Git commit is a node in a graph.
Git repo is one giant graph
![Page 59: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/59.jpg)
59
• Everything in Git is check-summed before it is stored
• Checksum used for reference Integrity!
• All objects are stored compressed in the Git Object Database and
referenced by the SHA-1 value of its contents (plus a small header)
• SHA-1 hash: 40-character hexadecimal string: 24b9da6552252987aa493b52f8696cd6d3b00373
Creating a branch is nothing more than just
writing 40 characters to a file
SHA-1 References
![Page 60: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/60.jpg)
60
development process
use branches for development
and merge them back to the
master branch upon completion
![Page 61: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/61.jpg)
61
local / remote workflow
Quelle: https://www.git-tower.com/learn/git/ebook/en/command-line/remote-repositories/introduction
![Page 62: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/62.jpg)
Git in the world of SAP
![Page 63: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/63.jpg)
63
SAP HCP
![Page 64: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/64.jpg)
64
SAP HCP
![Page 65: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/65.jpg)
65
SAP WebIDE
![Page 66: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/66.jpg)
66
SAP WebIDE
![Page 67: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/67.jpg)
67
Services Git Services Best Practices
HCP Git docu
![Page 68: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/68.jpg)
68
SAP at Github
![Page 69: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/69.jpg)
ABAP and Git
![Page 70: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/70.jpg)
70
ABAP and Git
http://www.abapgit.org
https://github.com/larshp
![Page 71: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/71.jpg)
71
abapGit
Live Demo
![Page 72: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/72.jpg)
72
More food for thought:
https://git-scm.com/
https://progit.org/
![Page 74: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/74.jpg)
Backup
![Page 75: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/75.jpg)
git commands
![Page 76: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/76.jpg)
76
git init
create a new repository
create a new git repository
![Page 77: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/77.jpg)
77
master
create a new repository
“master” is the default name for a
starting branch after git init
![Page 78: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/78.jpg)
78
git clone /path/to/repository
checkout a repository
create a working copy of a
local repository
![Page 79: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/79.jpg)
79
git clone username@host:/path/to/repository
checkout a repository
for a remote repository
![Page 80: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/80.jpg)
80
origin/master
create a new repository
“origin” is the default name Git
gives to the server you cloned from
![Page 81: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/81.jpg)
81
git add <filename>
add & commit
propose changes – add to the
Index
![Page 82: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/82.jpg)
82
git commit -m "msg"
add & commit
commits file to the HEAD – not
yet to the remote repo
![Page 83: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/83.jpg)
83
git push origin master
pushing changes
send changes from local HEAD
to your remote repository
![Page 84: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/84.jpg)
84
git push origin master
pushing changes
change master to whatever
branch you want to push your
changes to
![Page 85: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/85.jpg)
85
git remote add origin <server>
pushing changes
connect local repository to a
remote server
![Page 86: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/86.jpg)
86
branching
branches are used to develop
features isolated from each other
![Page 87: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/87.jpg)
87
branching
the master branch is the
"default" branch
![Page 88: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/88.jpg)
88
branching
use branches for development
and merge them back to the
master branch upon completion
![Page 89: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/89.jpg)
89
git checkout -b feature_x
branching
create a new branch named
"feature_x" and switch to it
![Page 90: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/90.jpg)
90
git checkout -b master
branching
switch back to master
![Page 91: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/91.jpg)
91
git checkout –d feature_x
branching
delete branch "feature_x"
![Page 92: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/92.jpg)
92
git push origin <branch>
branching
push the branch to your remote
repository – make it available for
others
![Page 93: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/93.jpg)
93
update & merge
use branches for development
and merge them back to the
master branch upon completion
![Page 94: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/94.jpg)
94
git fetch origin
update & merge
fetches any new work that has
been pushed to server (no merge!)
![Page 95: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/95.jpg)
95
git pull
update & merge
update local repository to the
newest commit – fetch and merge
changes
![Page 96: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/96.jpg)
96
git merge <branch>
update & merge
merge another branch into your
active branch (e.g. master) and
create a new commit (if there are
no conflicts)
![Page 97: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/97.jpg)
97
git add <filename>
update & merge
resolve merge conflicts on file level
and add / commit it again
![Page 98: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/98.jpg)
98
git diff <source_branch> <target_branch>
update & merge
show differences between
branches / create patches
![Page 99: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/99.jpg)
99
update & merge
use branches for development
and merge them back to the
master branch upon completion
![Page 100: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/100.jpg)
100
git tag
tagging
lists tags in alphabetical order
![Page 101: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/101.jpg)
101
git tag 1.0.0 1b2e1d63ff
tagging
create new “1.0.0” tag for a
commit – referenced by its id
![Page 102: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/102.jpg)
102
git log
log
repo history – parameters can
change the log output
![Page 103: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/103.jpg)
103
git log --author=bob
log
see only the commits of a certain
author, e.g. Bob
![Page 104: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/104.jpg)
104
git log --pretty=oneline
log
compressed log where each
commit is one line
![Page 105: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/105.jpg)
105
git log --graph --oneline --decorate –all
log
ASCII art tree of all the branches,
decorated with the names of tags
and branches
![Page 106: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/106.jpg)
106
git checkout --<filename>
replace local changes
replace local changes in working
tree with last content in HEAD
![Page 107: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/107.jpg)
107
git fetch origin
update & merge
fetches any new work that has
been pushed to server (no merge!)
![Page 108: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/108.jpg)
108
git fetch origin git reset --hard origin/master
replace local changes
drop all your local changes and
commits, fetch the latest history
from the server and point local
master branch at it
![Page 109: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/109.jpg)
![Page 110: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/110.jpg)
110
checksums in the .git directory
![Page 111: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/111.jpg)
111
git log
![Page 112: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/112.jpg)
112
the .git directory
![Page 113: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/113.jpg)
113
Working
Directory Index
(Staging Area)
HEAD (.git directory)
commit
checkout the project
stage fixes
pushing changes
send changes to remote repo
Remote
Repository
push
![Page 114: What the git? - SAP Inside Track Munich 2016](https://reader031.fdocuments.us/reader031/viewer/2022020410/58778c4c1a28ab0f778b469f/html5/thumbnails/114.jpg)
114
Working
Directory Staging Area .git directory
commit
pull
stage fixes
pulling changes
get changes from remote repo
Remote
Repository
push