visual-studioazure-devopsbranching-and-mergingteam-explorerfeature-branch

Merging and Deleting Feature Branch From Azure and Local Machine Repository


Here is the scenario

  1. I am the only developer in my team (stated to make it clear that there will be no change from other team members to consider)
  2. have a main branch stable and deployed on production server
  3. created a feature branch add some other features and changes into existing business flow
  4. Everything looks fine, now I wanted to merge these all new features to main branch

  5. Committed and synced on server all news changes are going to feature branch

  6. Created a pull request and approved it, it deleted feature branch from server but it still exists on Local machine
  7. The question is How to merge all changes into main branch and delete feature branch on local machine as well?

Solution

  • 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?