how to reset develop branch to master
I have develop
& master
branches, my develop
branch is messy now and i would like to reset it and make it as a copy of my master
. i'm not sure if merging the master
into develop
will make both of them identical. after trying to merge i got many conflicts i solved them using:
git checkout develop
git merge origin/master
//got many conflicts
git checkout . --theirs
is this enough for develop
branch to be an identical copy to master
?
Thanks
if you just want them to be the same thing
then
//from Develop and assuming your master is up to date with origin/master
git reset --hard master
If you want to make develop
be identical to master
, the simplest way is just to recreate the pointer:
git branch -f develop master
Or, if you already have develop
checked out:
git reset --hard develop master
Note however that both of these options will get rid of any history that develop
had which wasn't in master
. If that isn't okay, you could preserve it by instead creating a commit that mirrored master
's latest state:
git checkout develop
git merge --no-commit master
git checkout --theirs master .
git commit
Reset Last Commit
git reset HEAD~