If user changed the same line in the different branch & merge into the same branch(ex. main), conflict can occur.
Create Github Repository
Create Local Repository
mkdir git-practice
Clone
cd git-practice/
git clone https://github.com/wecode-bootcamp-korea/wecode-git-test.git
Remove remote connection
cd wecode-git-test/
git remote remove origin
Remote my own repository ‘Judy-Choi/git-practice’
git remote add origin https://github.com/Judy-Choi/git-practice.git
Create Main Branch & Push
Follow the Github repository’s direction
cd Backend/
git branch -M main
git push -u origin main
Github Repository
[main] app.js
Create new branch [feature/signup] from [main] & move into.
git branch feature/signup
git checkout feature/signup
Add signup code to app.js
[feature/signup] app.js
add & commit & push (pull request)
git add .
git commit -m "Commit message"
git push origin feature/signup
Create Pull Request on Github
Create new branch [feature/signin] from [main] & move into.
# Return to main
git checkout main
# Create new branch
git branch feature/signin
git checkout feature/signin
[feature/signin] app.js
Because I returned to [main] branch & create [feature/signin],
added codes in [feature/signup] are not here. (= same as [main])
Add signin code to app.js
[feature/signin] app.js
add & commit & push (pull request)
git add .
git commit -m "Commit message"
git push origin feature/signin
Create Pull Request on Github
Conflict occured in [feature/signin]!
(In another branch (not merged yet), conflict is occured)
Return to local [main] branch & Pull from remote [main] branch
git checkout main
git pull origin main
Merge [feature/signin] ← [main]
git checkout feature/signin
git merge main
Check the conflict & Save app.js
[feature/signin] app.js
add & commit & push (pull request)
git add .
git commit -m "commit message"
git push origin feature/signin
Resolved!
Now [feature/signup] & [feature/signin] are in [main].