Reputation: 561
I just merged a pull request on branch ticket-1
into my main
branch and deleted the ticket-1
branch. I did this through Github and now Github shows I have only one branch (main
). After the merge, I created a new branch from the main
branch called ticket-3
using the GitBash command git checkout -b ticket-3
.
After that, I noticed the code in my VScode reverted to the original code before the pull request merge. The changes made in the pull request were not in my VScode any longer, however they show up on the main branch on Github. Also, when I ran git branch
in my GitBash, I show that I have all three branches: main ticket-3 ticket-3
.
Not sure what is going on here, but I'm sure there is some syncing issue I am missing. Any help is appreciated.
Upvotes: 1
Views: 680
Reputation: 535159
I can't speak for VSCode, whose Git support is notoriously poor. However, in speaking just in terms of Git itself:
Syncing does not happen automatically with Git. The merging of the pull request at GitHub took place only at GitHub; there is now a new commit at GitHub that you don't have. To get it, switch to main
locally and pull
(or even better, fetch
and then merge
from the remote tracking origin/main
).
Note that when fetching, there is an option to prune branches that no longer exist at the remote. You might still have to delete your local ticket-1
manually; it depends on how the GUI works.
(You should probably do that before creating a new branch, so that the new branch takes off from the latest state of main
.)
Upvotes: 2