Basic Conflict
Reason: Resulting from hotfix being applied to the master branch after the feature branch had been created and the commits had not been merged into the feature branch.
Conflict: Following a push to Remote and creation of Merge Request gitLab displays conflict message :
The source branch is N commits behind the target branch.
N commits and 1 merge commit will be added to master.
Solution: From within local repository checkout the master and merge the feature branch into it. This created a merge via the Ort strategy. Then checkout the feature branch and merge the master into the feature, which adds the commits from the hotfix into the feature branch via the Fast Forward merge strategy. Push the local feature branch to the remote feature branch.
Avoid: Ensure that pulls are made after any merge to the master and that these commits are merged into the branch you are currently working on.
Result: Following push to remote Merge Request displays message:
gitLab 14 commits and 1 merge commit will be added to master.
Process:
git merge
git pull origin master
[if on another branch]
git merge
git checkout master
[view file conflict arose]
git merge
git merge <local-feature-branch>
[Console message: Auto-merging conflicting file
Merge made by the 'ort' strategy ]
//[open file fix conflict]
//[commit changes]
git switch <local-feature-branch>
[view file]
git merge master
[Console message: Updating ...
Fast-forward]
git status
[Console message: Your branch is ahead of <remote-feature-branch> by N commits]
git push
https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging