Reputation: 445
We have branches master
, develop
and mark
. The develop
branch is always the main development branch my partner works on and I use the mark
branch to add features.
I screwed something up because after merging with develop
my brach no longer works (currently there are no differences in master
and develop
). I need to bring mark
branch to the state of the develop
branch and throw away my changes. How do I do this with out removing the mark
branch or creating a new branch?
Upvotes: 0
Views: 323
Reputation: 1940
From the shell execute the commands to move (save) your current mark branch and create a new mark branch.
git checkout master
git branch -m mark mark.bad
get checkout -b mark
If you are absolutely determined to not create a new branch then do the following
git checkout master
git log -1 # copy the commit hash code to your clipboard
git checkout mark
git reset <hash code from master>
git stash save BrokenCode
This doesn't create a new branch. Instead it saves the bad code to your stash and resets mark to the state of master based on the hash code of master's HEAD.
Upvotes: 3