- How to resolve the conflicts
- Difference between merging and rebasing
- Creating and merging pull request
Create 3 branches:
conflict-maker
conflict-resolve-merge
conflict-resolve-rebase
You will use these 3 branches to create pull requests and resolve the conflicts.
Important: create branches before going to Learn how to
part.
Main goal is to go through happy flow of creating and merging pull request. Follow these steps:
- In
conflict-maker
branch modifyindex.js
file to look like following:
function iWillHaveConflicts(a, b) {
const _a = a + 1;
const _b = b + 2;
return _a + _b;
}
console.log(iWillHaveConflicts(10, 12));
- Commit and push changes to
conflict-maker
branch. - Create a pull request using GitHub.
- Merge pull request using
Squash and Merge
strategy.
Main goal is to go through flow there you will have a conflict and your personal preference of conflict resolvent is merge. Follow these steps:
- Checkout to existing
conflict-resolve-merge
branch. - Modify
index.js
file to look like following:
function iWillDefinitelyHaveConflicts(a, b) {
const iWillCreateConflicts = () => {
const _a = a + 1;
const _b = b + 2;
return _a + _b;
}
return iWillCreateConflicts();
}
console.log(iWillDefinitelyHaveConflicts(10, 12));
- Commit changes and push them to
conflict-resolve-merge
. - Create a pull request.
- See that you have a conflicts with master.
- Resolve them using merge.
- Push changes to
conflict-resolve-merge
.
Important: do not merge pull request.
Main goal is to go through flow there you will have a conflict and your personal preference of conflict resolvent is rebase. Follow these steps:
- Checkout to existing
conflict-resolve-rebase
branch. - Modify
index.js
file to look like following:
function iWillDefinitelyHaveConflicts(a, b) {
const iWillCreateConflicts = () => {
const _a = a + 1;
const _b = b + 2;
return _a + _b;
}
return iWillCreateConflicts();
}
console.log(iWillDefinitelyHaveConflicts(10, 12));
- Commit changes and push them to
conflict-resolve-rebase
. - Create a pull request.
- See that you have a conflicts with master.
- Resolve them using rebase.
- Push changes to
conflict-resolve-rebase
.
Important: do not merge pull request.