Git merge conflict

I’ve recently started using Git. I’ve run into a bit of a problem. I was working on something, that I committed, but when I went to push the commits I got a merge conflict. I pressed some stuff and somehow, the git repository has my commit as the head, and the work that was pushed right before mine was not merged (due to the conflict).

Could somebody please point me in the right direction?

I’m assuming that I need to somehow pull the previous commit (that was not merged), merge it with mine, and then push both back up.

I also realised that to deal with the merge conflicts I can use a tool like meld. Again, I’m quite new to this.


  • Using git, how to do a 'use theirs' during a conflict?
  • GitHub revert or reset?
  • Force git custom merge driver for the purpose of merging pom.xml (maven) files
  • Git revert merge plus one commit on top to re-merge again
  • git: how to review changes done in branch
  • Step-by-step usage of Visual Studio Git Extension for merging
  • Backing Out a backwards merge on Mercurial
  • Git: currently in merge/conflict with private remote repo. How to tell Git to just use my local files?
  • One Solution collect form web for “Git merge conflict”

    You can try:

    # restore the old version of that file
    # supposing it was 2 revisions ago on master branch
    git checkout master~2 -- path/to/your/file
    # merge it with the most recent version
    git checkout --merge -- path/to/your/file

    If it doesn’t work, then you need to restore that old file elsewhere, and manually merge it to your current revision for that file, adding and committing a new version (which, this time, won’t simply overwrite the old version).

    Git Baby is a git and github fan, let's start git clone.