简体   繁体   中英

Github package.json conflict when I submit PR

What is the common way to resolve package.json conflicts when a conflict error occurs when submitting a pull request?

I try git pull origin but this command makes too many merge commit.

You can try this

  1. Update the master branch with the latest changes:
git checkout master
git pull
  1. Merge your feature branch into master:
git merge mybranch

You will see something like the following message:

Auto-merging package-lock.json
CONFLICT (content): Merge conflict in package-lock.json
Auto-merging package.json
CONFLICT (content): Merge conflict in package.json
Automatic merge failed; fix conflicts and then commit the result.
  1. Open your editor (eg VSCode) and: Carefully resolve conflicts in package.json (if there is any) Ignore the conflicts in package-lock.json
  2. Install packages, which will re-generate package-lock.json:
npm install
  1. "Test drive" your application to make sure the conflicts in package.json have been resolved correctly.
  2. If the application is able to start up (ie there are no missing dependencies), add all changes and finish the merge:
git add --update
git commit
  1. If everything looks fine, push to GitHub:
git push

(Which I found solution in here .)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM