Is there a reset command that will move the master to another branch without merging? I have some unstable experimental code on branch MIN-791 which has already been merged to the master. I'd rather not deal with it if I don't have to for now. I'd like the MIN-780-493 branch to become the master branch since it has a couple of nice repairs but none of the crap. 'git reset sha#' didn't seem to do the trick. Is there another reset command that will? Or something else? I don't want to lose the changes on MIN-791 since it is still being used to fix a difficult bug, but don't want it in my releases.
Asked
Active
Viewed 1,011 times
1

jacknad
- 13,483
- 40
- 124
- 194
-
Please clarify *`git reset sha#` didn't seem to do the trick*. Did you get an error? What SHA did you use? – jub0bs Sep 26 '14 at 01:51
2 Answers
3
if you are checked out to master then this
git reset --hard SHA
That will also modify the staging area and working directory.
If you just want to randomly assign values to refs then you would use
git update-ref refs/heads/master SHA

Andrew C
- 13,845
- 6
- 50
- 57
-
WRONG update-ref OPTIONS! Make sure to use git update-ref refs/heads/master SHA. See http://stackoverflow.com/questions/13073062/git-warning-refname-master-is-ambiguous -- Leaving off the refs/heads/ will eventually cause you to have ambiguous masters and a scary looking log – user1902689 Feb 03 '17 at 21:04
1
Andrew C's answer is right. In addition you can just use the branch name instead of the SHA.
Ex:
git reset --hard origin/MIN-780-493

palazzo train
- 3,229
- 1
- 19
- 40