levibostian / action-sync-branches

GitHub Action to copy and push commits from one branch to another.
MIT License
0 stars 0 forks source link

Handle scenario where branch is behind *and* ahead of another branch. #26

Closed levibostian closed 2 years ago

levibostian commented 2 years ago

Let's say we have 2 branches: main and develop. develop is ahead of main since the team has been adding features to the project since the last production release. main is ahead of develop because there was a production release recently.

When the action runs, it will fail during rebase:

git switch main
git pull
git switch develop 
git pull

git rebase main # FAIL

git rebase will revert some commits where develop is ahead of main. In this scenario, we have to use git merge to merge in commits from main into develop.