'Sync local merge to remote GitHub repo
I created a test repo locally on my PC and added some text to it. Then created a test branch, merged it with main, deleted the test branch and pushed everything with git push. But when I check my GitHub copy of that repo the test branch still exists! Why?
Solution 1:[1]
deleted the test branch and pushed everything with git push. But when I check my GitHub copy of that repo the test branch still exists! Why?
That is by design. If you delete a branch locally, this deletion will not be automatically propagated when pushing your repository to a remote repository. This is because in general, it is normal and expected for a remote repository to have (many) branches that you do not exist in your local repository.
If you want to delete a branch in a remote repository, you need to delete it explicitly. This is done with git push:
git push --delete origin name-of-branch-to-delete
where, "origin" is the name of the remote repository (which is "origin" by default), and name-of-branch-to-delete is, obviously, the name of the branch you want to delete. Note that this must be the name of the branch in the remote repository - you may have given the branch a different name in your local repository (though by default the names will be the same).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | sleske |
