KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have just done a git merge --squash feature-branch into my develop branch. The problem is that the above command updated the head without creating a new commit. My intention was to create one single commit to apply to the head of develop . So in short, the log for the develop branch before and after the merge are exactly the same. Is there a way to revert back develop to what it was before the git merge ? Thank you. Solution Based on the comment from Dan D. and the accepted answer below I was able to resolve my problem. See below what I did in case you are in the same boat: 1 - I ran git reflog and it listed all the commits and checkouts I did with my develop branch. 2 - Instead of doing a git reset HEAD@{1} as suggested, I found the number when I did the last commit to develop that I wanted to keep. In my case it was HEAD@{188} . So I typed git reset HEAD@{188} . 3 - I ran a git log and it had a clean log showing only the commits I had before I did the wrong merge. 4 - I ran git add -A . to stage all the new files created during my feature development. 5 - I ran git commit -m "install feature-x" 6 - As a result now I have branch develop with the correct files and the log is clean - showing only one commit for all the changes I did during the development of feature-x . I still need to find out why my original git merge --squash feature-branch did not work as intended. Solution 2 Mark Longair's answer is a definitive solution to my problem. I have just tested it and it works. See below the process I am using now to squash all the internal commits within a <code
Tags (comma-separated)
Save Edits
Cancel