'Does a `git reset --hard upstream/main` delete also local branches?

If I do a git reset --hard upstream/main, will also my local branches be deleted by that command?

git


Solution 1:[1]

git reset does not delete branches.

git reset --hard upstream/main says to move the currently checked out branch to the same commit as upstream/main, and to clear your staging area of any changes, and to overwrite your files with the versions at upstream/main.

Your current branch will be at the same commit as upstream/main, and any staged or unstaged changes will be gone.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Schwern