Skip to content

Resolving merge conflicts

Melissa H edited this page Oct 23, 2020 · 9 revisions

Resolve Merge conflict

What is a merge conflict?

Merge conflicts occur when competing changes are made to the same line of a file, or when one person edits a file and another person deletes the same file. A merge can enter a conflicted state at two separate points. When starting and during a merge process.

Solving merge conflicts

The only correct way to solve conflicts is to pull new changes, create a new commit and push again. Multiple ways to do this depending on how you use git: through command line, VS code, some GUI etc.

From Github

  1. Pull the changes from the main repo to your forked repo
  2. Check for changes (VS code also provides a prompt to resolve the conflict)
  3. After solving the conflict, save and push the changes
  4. Ask for review by reaching out on discord or twitter.

From Terminal/Git Bash

To sync the Main repository and your Own repository from the Terminal, follow the steps below:

Remember to follow the below steps you must have Git Bash installed on your system.

Open VSCode & open Terminal as Bash in VSCode OR Open Git Bash directly in your local Repository & write the following code

  1. Point to the main repo and pull from it. Create a new remote in local for pointing the main repo.
  • git remote add upstream https://github.com/twindle-co/twindle.git
  1. To download all the changes and commits from main Repository to your local Repository.
  • git fetch upstream
  1. The current branch will be updated to reflect the merge.
  • git merge upstream/main
  1. Push the changes to own repository on Github.
  • git push origin main

(Alternative for step 2 & step 3)

  • git pull upstream main

Now your Own Repository & Main repository are in sync.

Note:- If you want to add some more information, open a new issue