Skip to content

Files

Latest commit

7b339f9 · Mar 11, 2016

History

History
7 lines (4 loc) · 360 Bytes

001-git-force-branch-change.md

File metadata and controls

7 lines (4 loc) · 360 Bytes

Git: Force Branch Change without Checkout

git reset --hard is a common action to force a branch to a different commit. But it only works if you've checked out the branch you're changing. If you want to change the branch without checking it out first, try:

git branch -f branch_to_change new_ref_to_point_to

Hat Tip: http://stackoverflow.com/a/1591255