Skip to content

Instantly share code, notes, and snippets.

@RuthNjeri
Last active September 23, 2019 08:41
Show Gist options
  • Save RuthNjeri/82f3adeac98c2343a0d7e832da3993b5 to your computer and use it in GitHub Desktop.
Save RuthNjeri/82f3adeac98c2343a0d7e832da3993b5 to your computer and use it in GitHub Desktop.

Merge conflicts

Happens when working on a team project when two/more developers have edited the same file.
Therefore, face the conflict courageously.

Assumption: current_branch(local branch) conflicts with a base branch called base-branch

Solving a merge conflict by rebasing

  1. git pull origin --rebase base-branch. If your local base-branch is upto date with origin, you can just do git rebase base-branch If merge conflicts persist:
  2. Fix merge conflicts by accepting either current changes, incoming changes or Accept both changes. Remember to cosult when fixing conflicts because you might end up removing crucial code.
  3. git add . all the changes that you have made.
  4. git rebase --continue to continue fixing merge conflicts.
  5. If merge conflict persists, repeat steps 2 to 4.
  6. If merge conflict is fixed then git push --force-with-lease current_branch.

Resources to further help

GithubHelp
Atlassian
Gitolite
Hackernoon

@lennykioko
Copy link

Nice job. This will be very beneficial for all of us moving forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment