Git Flow: Managing Main-Develop Version Discrepancy After Feature Merges

57 Views Asked by At
*   cde53d9 (origin/main, main) Merge branch 'develop'
|\
| *   7d94faa (HEAD -> develop) Merge branch 'feature/road-view' into develop

After merging the feature/road-view branch into the develop branch and subsequently merging develop into main, the main branch is now ahead of develop by one commit. In this situation, if I need to create new feature branches from the develop branch and continue working, should I merge main back into develop, aligning the versions, before proceeding with the work?

1

There are 1 best solutions below

0
TTT On

should I merge main back into develop, aligning the versions, before proceeding with the work?

No. Don't worry about the extra merge commit on main. The states of develop and main are the same; only a new merge-commit is missing on develop. So, you can merge main back into develop, but you don't have to. However, if you merge a hotfix into main that isn't yet on develop, then you must merge the hotfix (or better yet main) back down to develop as well.

That being said, note that standard Git Flow doesn't have a scenario where develop is directly merged into main. Instead an in-between release branch would be used. If you find yourself not needing a release branch, then you may not need the complexity of Git Flow. If this is your case, you could consider renaming develop to main and tag your releases so you know when you deployed. This workflow is simpler, and is commonly called "Feature Branch workflow", and also "GitHub Flow".