My dev branch is one more commit behind every pull request merge #23353
-
I have a dev branch, a staging branch and temporary feature branches. Every time I merge a pull request from dev to staging the dev seems to be one more commit behind? I don’t understand whats happening. How can I fix this? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
You’ll have to check the history to be sure, but I assume that’s a merge commit created when you merge. 🙂 |
Beta Was this translation helpful? Give feedback.
-
TerThesz:
The screenshot message actually says 1 commit ahead and 22 behind. There seem to be some serious synching problems between those two branches. Also, it’s not clear if this message refers to your local clone status or the status of the repository on GitHub. As usual, links to actual repositories would help helper to help out. |
Beta Was this translation helpful? Give feedback.
-
GitHub - TerThesz/your-http: Simple http server made for fun.Simple http server made for fun. Contribute to TerThesz/your-http development by creating an account on GitHub. The dev branch is 2 commits ahead because I am adding new features (I will make a pull request when I finish) and its 32 commits behinds because I have merged 32 pull requests (Well I have made more pull requests but I accidentally deleted the dev branch so I had to make a new one) |
Beta Was this translation helpful? Give feedback.
-
TerThesz:
This might depend on the merge strategy you’re using. By default, GitHub will create a merge commit for every PR merge (`–ff``), which is probably why you’re seeing the extra commit. I prefer to always use the Rebase-Merge strategy, which preserves a linear history. You can change this in your repository settings, and decide which should be the default PR merging strategy. You can also enforce linear history in branch protection rules, so you don’t accidentally introduce those extra merge-commits. https://www.bogotobogo.com/cplusplus/Git/Git_GitHub_Fast-Forward_Merge.php |
Beta Was this translation helpful? Give feedback.
This might depend on the merge strategy you’re using. By default, GitHub will create a merge commit for every PR merge (`–ff``), which is probably why you’re seeing the extra commit. I prefer to always use the Rebase-Merge strategy, which preserves a linear history.
You can change this in your repository settings, and decide which should be the default PR merging strategy. You can also enforce linear history in branch protection rules, so you don’t accidentally introduce those extra merge-commits.
https://www.bogotobogo.com/cplusplus/Git/Git_GitHub_Fast-Forward_Merge.php