I have ran
git fetch upstream +refs/pull/*:refs/remotes/upstream/pr/*
git fetch origin +refs/pull/*:refs/remotes/origin/pr/*
And I ended up with several hundreds of branches - 4 for each pull request (head, merge, and both from origin and upstream.
How can I get rid of these branches locally, in two steps?
I have tried
git branch -D refs/remotes/origin/pr/*
but that says "not found".
If you have a single remote repository, then you can omit all arguments. just need to run git fetch , which will retrieve all branches and updates, and after that, run git checkout <branch> which will create a local copy of the branch because all branches are already loaded in your system.
There is no command to explicitly undo the git pull command. The alternative is to use git reset, which reverts a repository back to a previous commit.
I usually just remove files from .git/refs and lines .git/packed-refs
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