background

  1. Under work_portal, the Master, Demo, Release, and Develop branches developed separately, each with a different idea;

  2. The daily/1.0.0 development branch based on the master is merged into the Develop or Release branch for testing, and there are a lot of conflicts, and only a few files or folders are involved in my own development.

appeal

  1. Merge your modified files into the target branch and build in Jenkins;

  2. Don’t want to fix conflicts that aren’t part of your own development;

operation

The master-based development branch, Daily /1.0.0, was merged into the Develop branch and then Jenkins built it

  1. All changes have been committed, keep the branch working tree clean

  2. Switch to the Develop branch and keep Develop up to date

git checkout develop    
git pull
Copy the code

Create a temp branch based on the Develop branch and switch to it

git checkout -b develop_temp
Copy the code

4. Replace the corresponding develop_temp file with the daily/1.0.0 specified file or folder

Git Checkout Daily /1.0.0Copy the code
  • If the development involves only the files in the SRC /routes/test folder, run
Git checkout daily / 1.0.0 SRC/routestest
Copy the code

After executing this command, the files in the daily/1.0.0 branch SRC /routes/test will replace the corresponding files in the develop_temp branch

5. Submit this checkout content to develop_temp

Git commit -amCopy the code

6. Switch to the Develop branch

git checkout develop
Copy the code

7, merging,

git merge develop_temp
Copy the code

If there is a conflict, the conflict occurs only under SRC /routes/test

At this point, the operation of merging the specified file or folder ends

reference

Git tips – How to merge individual files or folders from other branches

p.s.

Checkout the specific folder on develop directly from checkout daily/1.0.0. Since checkout is a direct substitution, you might lose records of someone else’s changes to the files in those folders, so I added a develop_temp.