问题
I am a relative beginner at git - I have two branches: master
and frontend
. I've recently done something that's messed everything up and I don't know how to fix it. I cannot seem to find a way forward without making it worse - I would appreciate your indulgence.
This is my gitk --all
:
Top blue: stash
WIP on frontend
Second blue: index on frontend.
Red: Local uncommitted changes, not check in to index
Green: Local changes checked in to index but not committed
Yellow: frontend
and master
branches
5 blues in a line: These are commits made on frontend
before yesterday's merge
Tan box: my repo on Github (remotes/origin/master
)
Bottom green box: the production site (remotes/production/master
)
What happened
Last night I did git stash
on frontend
to clear my working tree, then git checkout master
then git merge frontend
.
The merge ran into conflicts, then in an attempt to reverse the merge I ran git reset HEAD@{1}
, and now I'm here and I don't know what to do to clean this up.
I would ideally like to have my two branches back with their separate dirty working trees (frontend's working tree is stored in stash and master's was merged). Thank you for any help you can give.
回答1:
Use git reflog
to find out where your HEAD
was before you did the git reset HEAD@{1}
. Then reset back to that.
来源:https://stackoverflow.com/questions/9206976/merging-commits-from-branch-to-master-odd-looking-tree