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?
- How do I change the branch I merged into in my previous commit?
- Tortoisesvn skips recording mergeinfo
- Git revert merge plus one commit on top to re-merge again
- Cannot resolve GitHub conflict in PR
- merging code outside of git into an existing git project
- Git: Patching another branch
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.
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).