Reputation: 3613
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.
Thanks.
Upvotes: 1
Views: 195
Reputation: 1329412
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).
Upvotes: 1