In Git, I understand that a branch is a pointer to a commit.
How do I make a specific branch point to a specific commit? Say I want to make master point at 1258f0d0aae..., how do I do that?
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.
You can make
masterpoint at1258f0d0aaethis way:But you have to be careful about doing this. It may well rewrite the history of that branch. That would create problems if you have published it and other people are working on the branch.
Also, the
git reset --hardcommand will throw away any uncommitted changes (i.e. those just in your working tree or the index).You can also force an update to a branch with:
… but git won’t let you do that if you’re on
masterat the time.