I moved some commits to another branch by
git checkout -b old-state 0d1d7fc32
Now I want to push my local master state to master but
Everything up-to-date
occurs. How can I revert original state?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Let’s sum things up:
mastertoorigin/mastermasterto revision0d1d7fc32origin/masterto point to0d1d7fc32This is how to achieve that:
reset your local master branch to
0d1d7fc32:git checkout mastergit reset --hard 0d1d7fc32Make
origin/masterandmasterequal:git push -f origin master:masterDone.
Do not confuse Git commands with those you might know from other VCS. I know that there are some VCS where
checkoutmeansThis is not the case with Git. Maybe you want to browse http://git-scm.com/ to get a first impression what it’s all about and then read a book or so.
Original answer:
git checkout -b old-state 0d1d7fc32creates a local branch calledold-statewhose last commit is that one with the SHAd1d7fc32.I assume you want to have
origin/masteron the same state as your localmasterbranch.In that case, do a
to make them equal.
git checkoutdoesn’t move anything. It just creates a new branch calledold-statethat shares the same history like the current branch. If you pass a revision number, it shares the same history until (and including) the given revision.