Reputation: 56
I have a remote branch named production, recently i messed it up by merging with some buggy branch. after that i deleted the branch and recreated. but now when anyone merges that branch locally in their branch, that buggy code also comes in that branch, as they might be having that buggy production branch on their local system.
We can locally delete the branch, but it's difficult to make every user delete it, is there any way that we can prevent that old buggy production branch code? Is there a way to make every user delete that branch locally before they use it for merging or anything?
Upvotes: 2
Views: 49
Reputation: 55483
You can't.
This is actually explained in the section "Recovering from upstream rebase" section of the git-rebase(1)
manual page.
You should do something like this:
Ask everyone go git fetch
.
This action will rewrite the remote branch matching that one you have replaced in everyone's local repository.
Ask the developers to verify they have not this branch merged anywhere.
This is doable by running
git branch --contains origin/messed_up_branch
This command should output nothing.
If someone had that branch merged, their local branches containing such a merge have to be fixed up. Supposedly via git rebase -i
or forking off a temporary branch prior to the merge point, merging with your new branch and then cherry-picking the commits made after the original merge from the original branch.
Upvotes: 3