1

I'm working on a fork from an upstream repo. Locally I'm on branch foo. I pushed foo up to my repo on GitHub and opened a PR into upstream/master and had it merged.

After merging I deleted the the foo branch on GitHub and also locally:

git branch -d foo

But if I view my log with:

git log --graph --pretty=oneline --abbrev-commit --decorate --all

Then I still see origin/foo.

I read in another answer to use:

git remote prune origin

Which successfully removed the origin/foo.

  • Is this the correct GitHub workflow when deleting a feature branch?

process:

delete branch on GitHub -> delete branch locally -> prune the origin
Community
  • 1
  • 1
mbigras
  • 7,664
  • 11
  • 50
  • 111

1 Answers1

1

Yes, it is one possible workflow, and you can set (since Git 1.8.5):

git config remote.origin.prune true

That way, a simple git fetch is enough.

Another approach is to delete locally, then push that deletion:

$ git push origin --delete <branch_name>
$ git branch -d <branch_name>
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250