cdonner
cdonner

Reputation: 37668

"Unmerged commits were discarded" locally after merging pull request on Github

  1. Receive pull request email from Github
  2. Fetch, and check out feature branch xzy to test what is in it
  3. Looks good - approve, squash & merge, and delete feature branch on Github
  4. Check out and pull master
  5. I still have the local feature branch, even though I have not made any changes, and it was merged into master on the server. When I delete it in IntelliJ, it will warn me that "Unmerged commits were discarded", and it lists the commit from the feature branch. But the changes are in the master that I pulled. Doing another "Fetch" does not change my local branches.

What unmerged commits does it mean? Do I need to do anything differently?

Upvotes: 1

Views: 767

Answers (2)

Marcos Ranes
Marcos Ranes

Reputation: 41

Your local origin doesn't know about you've done on your remote (github, gitlab, [...],). You're merged/squashed/rebased out there, not here in your local origin. No worries, so once your last features were held there after you have accepted and confirmed the pull request you can kill the auxiliary branch safely. Sometimes is needed a --force on it, but at first get started with -d, it isn't working -D. $ git branch -d branch-name or $ git branch -D branch-name

Upvotes: 1

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521997

I think the issue here is perhaps something of a head fake. The unmerged commits to which IntelliJ is referring are probably the commits in the feature branch which you squashed down before merging back into the master branch. So, the master branch does have the feature you built, but it received some squashed commits. The original commits in the feature branch in fact were never merged, and IntelliJ is just warning you about this.

I don't think you need to do anything differently based solely on this warning message from IntelliJ (or Git).

Upvotes: 2

Related Questions