Question

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

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top