Version Control
Git: Moving ahead
Git: Moving ahead
  • Group 1
    • Resolving Merge Conflict
      • Create master
      • Create a branch
      • Merge them
  • Group 2
    • Branching Demo
      • Create issue53 branch
      • Commit a change
      • Check out master
      • Create a hotfix
      • Merge Hotfix
      • Delete the hotfix
      • Switch back to issue 53
  • Group 3
    • Adding Collaborators
      • Send invite
      • Accept Invite
Powered by GitBook
On this page
  • Create a new change in master
  • Merge the branch on master
  • Results in conflict
  • Resolve manually
  • Commit again
  1. Group 1
  2. Resolving Merge Conflict

Merge them

Create a new change in master

Only to simulate a conflict!

git checkout master
echo "content modified in master" > code.txt
git commit -am "content modified in master"

Merge the branch on master

git merge feature

Results in conflict

Auto-merging code.txt
CONFLICT (content): Merge conflict in code.txt
Automatic merge failed; fix conflicts and then commit the result.
cat code.txt

<<<<<<< HEAD
content modified in master
=======
some content from feature
>>>>>>> feature

Resolve manually

Resolve manually using some file editor (What you keep in the final modification is upto you and the other developer as per situation)

Commit again

After final modification, commit again

git commit -am "merged feature"
git log --oneline

Merging is now complete!

PreviousCreate a branchNextBranching Demo

Last updated 2 years ago