Reputation: 4982
OK this is stupid, I don't understand what I'm missing here:
I go to the commit view of master branch. There's a commit with the same message as my commit message pointing to the my PR with the exact diff/change I made. But the thing is the commit ID is different (de5db73) and of course when I try to sync my local repository, git complains
warning: `rad-branch' was deleted on origin, but appears not merged into master
When I check the network graph my branch is not merge yet (I restored my branch)!
I don't know what's happening here. AFAIK there's no force push or anything like that. To my understanding it should have been a simple fast-forward merge. It happens from time to time to me. Does anybody know what could be the issue?
UPDATE: AFAIK there was no squash or anything like that. It turned out the PR was merged with squash!
Upvotes: 2
Views: 2102
Reputation: 487725
GitHub does not actually run git merge
at all. They can't, as the repositories on GitHub have no work-tree. This is not really the important part of the answer, but realizing that GitHub does not use normal Git commands will help you get the right mindset: the buttons on the GitHub web page do not quite act like regular Git commands.
What GitHub does is to run the moral equivalent of git merge --squash
or git rebase
or git merge --no-ff
. If the user who accepts and merges your pull request invokes the last one, your commit hash goes in unchanged, and they add a merge commit as well to make this happen. But if the user who accepts and merges your pull request uses one of the other two actions, your commit is (or commits are) discarded. Instead, they add their own commit(s), which is/are similar to yours, but different. In this case, your commits are not merged, and you must throw away your own commits and switch to theirs. (That's not super-friendly of them—of GitHub or of the person who accepted the pull request—but that's your option.)
Upvotes: 4
Reputation: 174937
It sounds to me like you have squash or rebase or something similar to that enabled for your repository.
A simple merge would maintain your commits and simply create a new on on top of master and your own branch, and advance master.
What your describing implies some configuration to change that default behavior has been set. Look into the repo's settings, specifically ones related to merge and pull requests.
Upvotes: 3