Reputation: 5
Here is the scenario
Everything looks fine, now I wanted to merge these all new features to main branch
Committed and synced on server all news changes are going to feature branch
Upvotes: 0
Views: 1449
Reputation: 174
We can just delete the remote-tracking branches at VS with the command "git config remote.origin.prune true" or set the "Prune remote branches during fetch" combo (Team Explorer->Settings->Git Global Settings) is true.
The various prune options (git remote update --prune, git remote prune, git fetch --prune) only delete remote-tracking branches.
If we want to deleted the local branches, we can only delete them manually.
You'll need to manually delete local branches you no longer want, or change or remove their upstream setting if the remote-tracking branch no longer exists.
For more details, you can rewards here: git fetch origin --prune doesn't delete local branches?
Upvotes: 1
Reputation: 1506
After completing the PR and having the remote feature branch deleted, you'll need to do a fetch into your local clone. By default, the remote tracking branches in the local clone aren't deleted. You can call "git fetch --prune" to do that cleanup.
If you have a local main branch, you'll need to pull it from the remote main branch to get it up to date.
If you would like to have fetch always prune, you can set a config option to force this behavior. Team Explorer includes the ability to set this in the UI. Team Explorer->Settings->Git Global Settings, and look for the "Prune remote branches during fetch" combo.
Hope this helps.
Upvotes: 0