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 then push it to the server.
I'm not sure if merging the master into develop will make both of them identical. after trying
git branch -f develop master
git checkout develop
I get the following message
Switched to branch 'develop' Your branch is behind 'origin/develop' by 34 commits, and can be fast-forwarded. (use "git pull" to update your local branch)
I want to update the remote too.. how do I do this? how do I get around all this
Please note that this will rewrite history and anyone else that is working off of an old copy of the origin's develop branch will need to update in a similar fashion. Otherwise things will get very sloppy.
# Delete your local develop
git checkout master
git branch -D develop
# Recreate your local develop, based on origin's master
git pull origin master
git checkout -b develop
# Push and overwrite the sloppy develop on the origin
git push origin develop --force
This is what I would do:
git checkout develop
git reset --hard master
git push --force origin develop
The commands you mentioned should also work, you are just missing the push.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.