Remove only on Local any Remote branch no longer include in fetch

43 views Asked by At

for example, I have the following Branches:

  • main -> tracking origin/main
  • feature/f1 -> tracking origin/feature/f1
  • feature/f2 -> tracking origin/feature/f2 and in .gitconfig
[ remote "origin"]
    url = ...
    fetch = +refs/heads/*:refs/remotes/origin/*

now I only want to see the feature-branches, therefor update .gitconfig to:

[ remote "origin"]
    url = ...
    fetch = +refs/heads/feature*:refs/remotes/origin/feature/*

Is there any way to remove the local stored main branch, without deleting it on the remote server?

1

There are 1 answers

0
Adrian J. Moreno On

You can delete any local branch at any time. This does not do anything to the remote branches.

git branch -d main

Just DO NOT push a delete command to your remote.

git push origin --delete main