4

I looking for the command which not available in git version 1.7.4 but I am not be able to upgrade the git client.

So, are there any command which equivalent to

git push --prune
scalopus
  • 2,640
  • 3
  • 19
  • 32

1 Answers1

1
  • The prune for remote "Deletes all stale remote-tracking branches under <name>. These stale branches have already been removed from the remote repository referenced by <name>, but are still locally available in "remotes/<name>". "
  • The prune for push "Remove remote branches that don’t have a local counterpart".

The idea would be to list all remote branches (git branch -r), and if there is no local branch with the same name, to git push origin :remoteBranchName (delete it on the remote)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    when we prune, I needs to delete "all" remote branches which not available. To done manual with `git push origin :remoteBranchName` it still take time in case that we have 100+ branches and have to compare one-by-one. – scalopus Oct 24 '12 at 15:04
  • @scalopus true, I was just giving the idea of what git push --prune does. To automate it, you would have to list all of the remote branches through a `git for-each-ref`, a bit like in http://stackoverflow.com/a/4952368/6309 – VonC Oct 24 '12 at 15:10