Forces an update of the remote branch after rewriting the history locally. Use git push -f to force update the remote branch, overwriting it using the local branch's changes. This operation is necessary anytime your local and remote repository diverge.
git pull updates your current local working branch, and all of the remote tracking branches.
git remote update will update all of your branches set to track remote ones, but not merge any changes in. git fetch will update only the branch you're on, but not merge any changes in. git pull will update and merge any remote changes of the current branch you're on.
If it were branches in remote repository that got deleted, and you want to update all local remote-tracking branches at once, you can use
$ git remote prune <remotename>
to delete all stale remote-tracking branches for a given remote (i.e. those that follow branches which were removed in remote repository).
See git remote
documentation.
git remote update --prune
Should refresh all remotes' branches, adding new ones and deleting removed ones.
Edit:
The remote update command basically fetches the list of branches on the remote.
The --prune
option will get rid of your local remote tracking branches that point to branches that no longer exist on the remote.
If you perform something like
git branch -d -r remote_name/branch_name
you only remove your local checkout. This command doesn't do anything to the remote repository, which is why it still shows up.
Solution:
git push origin :branch_name
will remove the the remote branch (note the ':'), and
git branch -d branch_name
will remove your local checkout.
(Reference)
Also useful for seeing new remote branches:
git fetch --all
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With