Does a git reset --hard upstream/main delete also local branches?
Does a git reset --hard upstream/main delete also local branches?
https://stackoverflow.com/questions/71475328/does-a-git-reset-hard-upstream-main-delete-also-local-branches
Asked 3 years, 10 months ago Modified 3 years, 10 months ago Viewed 596 times 0
If I do a git reset –hard upstream/main, will also my local branches be deleted by that command?
git Share Improve this question Follow edited Mar 15, 2022 at 0:47 Schwern’s user avatar Schwern 167k2828 gold badges226226 silver badges372372 bronze badges asked Mar 14, 2022 at 23:28 cnewbie’s user avatar cnewbie 18966 bronze badges Add a comment 1 Answer Sorted by:
Highest score (default) 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.
Share Improve this answer Follow answered Mar 15, 2022 at 0:46 Schwern’s user avatar Schwern 167k2828 gold badges226226 silver badges372