Reputation: 183
I've been facing some issues with GIT lately. In my work we have some branches for develop, QA and so... sometimes a branch gets contaminated so we have to reset it. We make it like this:
git branch -D develop_branch
git checkout -b develop_branch
git pull origin develop_branch
In this very moment, the old code comes to our new branch. It may take some time for git to delete the branch? There's a way to be sure that the branch is deleted?
Thank you!!
Upvotes: 0
Views: 482
Reputation: 1546
Even though the remote branch is deleted, you still have a copy of it in your refs/remotes
. Add --prune
to git pull
(or git fetch
) to automatically delete local remote refs not present in the origin.
git branch -D develop_branch
git push origin :develop_branch
(or delete remote branch via GitHub interface)git checkout -b develop_branch
git pull --prune origin develop_branch
Upvotes: 3
Reputation: 361
Check if remote branch is deleted:
git branch -r
will show all remote branches
You don't need to use github interface to delete a remote branch, instead do:
git push origin :develop_branch
(Note the colon : before local_branch_name)
And in addition: after you make a new local branch, push it like this to 'copy' it to remote:
git push --set-upstream origin newlocalbranch
Upvotes: 0