You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
Markdown
47 lines
1.1 KiB
Markdown
# DEMO: Git Conflict
|
|
|
|
Before the demo:
|
|
|
|
```
|
|
cp -r src\ git-conflict-demo-repo
|
|
cd git-conflict-demo-repo\
|
|
git init
|
|
git checkout -b main
|
|
git add calculator.ts
|
|
git commit -m "initial commit"
|
|
```
|
|
|
|
During the demo:
|
|
|
|
|
|
1) Create a feature branch
|
|
```git branch fix-multiplication```
|
|
1) Checkout to branch
|
|
```git checkout fix-multiplication```
|
|
1) Fix the multiplication function
|
|
1) Add & Commit changes
|
|
```git add calculator.ts```
|
|
```git commit -m "fix multiplication"```
|
|
1) Note that we did not merge the changes yet, they are in the feature branch
|
|
1) Checkout to main
|
|
```git checkout main```
|
|
|
|
|
|
1) Checkout to another feature branch
|
|
```git branch fix-calculator```
|
|
1) Make conflicting changes
|
|
1) Add & Commit changes
|
|
```git add calculator.ts```
|
|
```git commit -m "fix calculator"```
|
|
1) Checkout to main
|
|
```git checkout main```
|
|
1) Merge the changes
|
|
```git merge fix-calculator```
|
|
|
|
1) Try to merge the changes from the first branch
|
|
```git merge fix-multiplication```
|
|
1) Observe the conflict message
|
|
1) Fix the source code
|
|
1) Add & Commit the changes
|
|
```git commit -am "fix merge conflict"```
|
|
1) Observe the finished product |