85
1

PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

1

Page 2: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

2

Page 3: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

3

Page 4: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

4

Page 5: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

5

Page 6: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

6

Page 7: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

7

Page 8: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

8

Page 9: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

9

Page 10: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

10

Page 11: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

11

Page 12: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

12

Page 13: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

13

Page 14: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

14

Page 15: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

15

Page 16: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

16

Page 17: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

17

Page 18: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

18

Page 19: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

19

Page 20: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

20

Page 21: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

21

Page 22: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

22

Page 23: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

1

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()

2 3 4 5

dev master

HEAD

23

We created the “dev“ branch.

Page 24: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

1

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()

2 3 4 5

dev master

HEAD

24

We checked-out the “dev“ branch.

Page 25: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

1

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()

2 3 4 5

dev master

HEAD

game.py .gitignore

25

We created the code for the actual game and the “.gitignore” file.

Page 26: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

1

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()

2 3 4 5

dev master

HEAD

game.py .gitignore

26

We staged both files.

Page 27: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

1

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

2 3 4 5

dev

HEAD

6

master

27

We created a commit.

Page 28: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

1

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

2 3 4 5

dev

HEAD

6

master

28

We checked-out the “master“ branch.

Page 29: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

1

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

2 3 4 5

devmaster

HEAD

6

29

We merged “dev“ into “master”.

Page 30: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

30

Page 31: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

31

Page 32: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

32

Page 33: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

33

Page 34: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

34

Page 35: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

35

Page 36: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

36

Page 37: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

37

Page 38: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

38

Page 39: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

39

Page 40: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

40

Page 41: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

41

Page 42: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

42

Page 43: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

43

Page 44: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

44

Page 45: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

45

Page 46: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

46

Page 47: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

47

Page 48: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

1

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

2 3 4 5

master

HEAD

6

all_the_same 48

We created the “all_the_same“ branch.

Page 49: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

1

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

2 3 4 5

master

HEAD

6

all_the_same 49

We checked-out the “all_the_same“ branch.

Page 50: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

17 – refactor code into all_the_same()

1 2 3 4 5 6

7all_the_same

master

HEAD 50

We created a new commit.

Page 51: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

17 – refactor code into all_the_same()

1 2 3 4 5 6

7all_the_same

master

HEAD

51

We checked-out the “ master“ branch.

Page 52: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

17 – refactor code into all_the_same()18 – add check for a draw

master

HEAD

1 2 3 4 5 6 8

7all_the_same 52

We created a new commit.

Page 53: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

17 – refactor code into all_the_same()18 – add check for a draw19 – merge branch ‘all_the_same‘

master

HEAD

1 2 3 4 5 6 8

7all_the_same

9

53

We merged “all_the_same” into “master”.

Page 54: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

17 – refactor code into all_the_same()18 – add check for a draw19 – merge branch ‘all_the_same‘

master

HEAD

1 2 3 4 5 6 8

7

9

54

We deleted the “all_the_same” branch.

Page 55: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

55

Page 56: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

56

Page 57: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

57

Page 58: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

58

Page 59: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

59

Page 60: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

60

Page 61: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

61

Page 62: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

62

Page 63: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

63

Page 64: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

64

Page 65: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

65

Page 66: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

66

Page 67: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

67

Page 68: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

68

Page 69: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

69

Page 70: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

70

Code before paths diverged:

Changes on the “master” branch:

Changes on the “valid_move” branch:

Page 71: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

71

Page 72: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

72

Page 73: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

73

Page 74: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

74

Page 75: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

75

Page 76: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

76

Page 77: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

77

Page 78: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Working Directory

Staging Area

Repository

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

17 – refactor code into all_the_same()18 – add check for a draw19 – merge branch ‘all_the_same‘

master

HEAD1 2 3 4 5 6 8

7

9

valid_move 78

We created and checked-out the “valid_move” branch.

Page 79: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

10

Working Directory

Staging Area

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

17 – refactor code into all_the_same()18 – add check for a draw19 – merge branch ‘all_the_same‘

10 – add check if player‘s move is valid

valid_move

Repository

1 2 3 4 5 6 8

7

9

master

HEAD

79

We created a new commit.

Page 80: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

10

Working Directory

Staging Area

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

17 – refactor code into all_the_same()18 – add check for a draw19 – merge branch ‘all_the_same‘

10 – add check if player‘s move is valid

valid_move

Repository

1 2 3 4 5 6 8

7

9

master

HEAD

80

We checked-out the “master” branch.

Page 81: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

10

Working Directory

Staging Area

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

17 – refactor code into all_the_same()18 – add check for a draw19 – merge branch ‘all_the_same‘

10 – add check if player‘s move is valid11 – rename change() to make_move()

valid_move

Repository

1 2 3 4 5 6 8

7

9

master

HEAD

11

81

We created a new commit.

Page 82: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

10

Working Directory

Staging Area

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

17 – refactor code into all_the_same()18 – add check for a draw19 – merge branch ‘all_the_same‘

10 – add check if player‘s move is valid11 – rename change() to make_move()12 – merge branch ‘valid_move‘

valid_move

Repository

1 2 3 4 5 6 8

7

9 11 12

master

HEAD

82

We merged “valid_move” into “master”.

Page 83: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

10

Working Directory

Staging Area

11 – initial commit12 – update README13 – define change()14 – enable variable size of the game board15 – define determine_game_status()16 – create code for the actual game

17 – refactor code into all_the_same()18 – add check for a draw19 – merge branch ‘all_the_same‘

10 – add check if player‘s move is valid11 – rename change() to make_move()12 – merge branch ‘valid_move‘

Repository

1 2 3 4 5 6 8

7

9 11 12

master

HEAD

83

We deleted the “valid_move” branch.

Page 84: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Merge Type Commits

Example 1 fast-forward Merge • create code for actual game

Example 2three-way merge without

Merge-Conflict• refactor code into all_the_same()• add check for a draw

Example 3three-way merge with

Merge-Conflict• add check if player‘s move is valid• rename change() to make_move()

Examples for Merging Branches

84

Page 85: PowerPoint-Präsentation · 2020. 1. 22. · Example 1 fast-forward Merge •create code for actual game Example 2 three-way merge without Merge-Conflict •refactor code into all_the_same()

Version Control

Creating a Commit BranchesWorking Directory

Staging Area

Local Repository

git branch

git merge

git status

git add

git commit

git restore

git log

git checkout

git diff

git clone

git init

git config

85