dev-ng
dev-ng

Reputation: 31

What is the best way to get rid of merge conflicts when pulling commits from master?

After I branch from master, after a while, when I pull (other people's) code from master there are merge conflicts (i.e. package.json and package-lock.json).

I usually git rebase master my branch, but when I push my code, it shows other people's commits since I have branched off in the "Changed Files" section of the PR.

How do I keep my branch up to date with master without including other developers changes, just my changes for my branch?

Upvotes: 2

Views: 722

Answers (1)

dev-ng
dev-ng

Reputation: 31

This way has worked for me (assume a branch develop has branched off of master):

  1. (on master): git pull origin master
  2. (switch to develop): git checkout develop
  3. (on develop): git merge master

Resolve merge conflicts 1 by 1 then git commit when prompted

Upvotes: 1

Related Questions