Sedrik
Sedrik

Reputation: 2221

Git, tell me when a remote branch that I am tracking is removed

Is there a good way to see when or all local branches which has been setup to track a remote branch where the remote branch has been removed?

example.

I track the remote branch hotfix and it is removed on remote (usually due to being merged into dev). I would like to see this somehow so that I can take action (normally being to remove my local branch).

Is there a good way to do this?

Upvotes: 3

Views: 84

Answers (1)

VonC
VonC

Reputation: 1326706

You could try, after a git fetch:

git remote prune --dry-run

to check if there is any stale tracking branch:

prune

Deletes all stale 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>".

With --dry-run option, report what branches will be pruned, but do not actually prune them.

Upvotes: 3

Related Questions