💻 Software
How do I reset 'master' to 'origin/master'?
Fresh7 days ago
Mar 15, 2026523166 viewsConfidence Score1%
1%
Problem
Can I do the following in a simpler way?
Error Output
git checkout origin/master git branch -D master git branch master git checkout master
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: How do I reset 'master' to 'origin/master'?
Low Risk
As KindDragon's answer mentions, you can recreate directly at with: The man page mentions: If is given, is created if it doesn’t exist; otherwise, it is reset. This is the transactional equivalent of Since Git 2.23+ (August 2019), since is too confusing, the new (still experimental) command is : That is: Similar to except that if already exists, it will be reset to . This is a convenient shortcut for: Originally suggested: Something like: with step 2 being optional.
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix