Amelio Vazquez-Reina
Amelio Vazquez-Reina

Reputation: 96468

Difference between `git remote prune` and `git branch -d -r`

As far as I understand these two commands can remove remote-tracking branches. Is there any difference between them?

Upvotes: 1

Views: 237

Answers (1)

Adam Dymitruk
Adam Dymitruk

Reputation: 129782

Yes. But you can prove it to yourself: copy your git repo and run each command in each copy. Then do a diff on the two .git folders within those repos.

Your prune command needs the remote name, not the branch name. This will delete all remote tracking branches that are not on the remote specified. Your branch -d -r parameter should be <remote>/<branch_name>.

Upvotes: 1

Related Questions