title: Undoing a Fast-Forward Merge
body: <p>I had a bad merge, I did not know it was a bad merge until I pushed it to GitHub and now I do not know how to undo/revert it. </p>
  
  <p>The story goes like this: </p>
  
  <p>I opened two distinct branches and committed several changes to those branches. After a while, I decided to merge those branches back to master branch and I use <code>$ git merge branch_name</code> for this purpose. I merged the first branch and checked out the log of master branch afterwards: all commits on that branch were on master. Then I proceeded with the merging of second branch by the same command. Then I checked the log of master again, where I saw the commits on the branch I merged including a commit with the following comment: "merge branch branch_name". A comment like this was not included when I merged the other branch. </p>
  
  <p>Long story short, the problem is that git merged the commits of the first branch to master like they are the commits of the master already. When you examine the network graph from 'GitHub' or the graph from 'gitg', there is no trace of the first branch left, but its commits are shown as the commits of master branch. There is no problem with the second branch: it is shown separately and it is merged as expected. Also note that, after running the merge commands, I went on deleting the branches by <code>$ git branch -d branch_name</code>, like it was the most urgent thing to do, unfortunately.</p>
  
  <p>Now I want to go back to the position just before I ran two consecutive merges. Any help is appreciated. If you comment on why this has happened, it will be pleasing as well.  </p>