Branch not auto-closed after commit lands in main

Say I have this workflow:

$ # checkout a branch off of origin/main
$ git checkout -b new-branch origin/main
$ echo "hello" > file.txt
$ git add file.txt
$ git commit -m 'add file.txt'
$ git push origin head:new-branch
$ # Open pull request for new-branch into main. PR gets reviewed and approved
$ # I'll now push to the main branch
$ git push origin head:main 

At this point, I’d expect the pull request to get auto-closed because the commit hash for the head of new-branch is in the main branch. This usually works, but I’ve observed multiple cases where the branch is not auto closed.

1 Like