I cannot push to my brach because a merge is in progress
Asked by Lucas Rei Ramos:

Hello,

I must admit I'm a novice in Bitbucket and in Git in general. I'm using Sourcetree and working in a repository in Bitbucket.

I'm working with a plugin within a videogame project, for which I am the only responsible of. For the record, the game engine is Unity and the plugin is FMOD (an audio middleware). I'm the only one modifying the relevant files of the plugin (the FMOD project and the audio banks) within Unity.

I have a separate branch for my work with the plugin. There have been changes made into my branch, with a new version of the app for testing. I don't know what I've done, but at this point:

* If I pull the changes, I get this error:

```
error: You have not concluded your merge (MERGE_HEAD exists).
hint: Please, commit your changes before merging.
fatal: Exiting because of unfinished merge.
```

* If I make a commit, I get this error after a long blue block of text:

```
fatal: cannot do a partial commit during a merge.?
```

* If I try to make a push (which would be useless without committing), I get this (I modified the names of the repositories and client):

```
Pushing to https://bitbucket.org/foo/bar.git
To https://bitbucket.org/foo/bar.git
= [up to date] Production-MVP -> Production-MVP
! [rejected] FMOD -> FMOD (non-fast-forward)
error: failed to push some refs to 'https://bitbucket.org/foo/bar.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
```

It looks I've started a merge, but I don't know how and how to get out of this.

What I want is to accept any change made by the developers, except from the relevant files for FMOD, which I believe they did not touch (aside maybe for some caches and such), and push my changes for the relevant FMOD files. For a complete noob in git, bitbucket and sourcetree, how do I make this?

Many thanks


Answers:
author: Saxea _Flowie_
body: Hi [@Lucas Rei Ramos](/t5/user/viewprofilepage/user-id/5300974)

Probably a merge conflict.

Do a \`git status\` and this should give you more details.

comments: author: Lucas Rei Ramos
body: Hello [@Saxea _Flowie_](/t5/user/viewprofilepage/user-id/5230209)

Thanks for your hint. I did that, and this is what I get:

```
On branch FMOD
Your branch and 'origin/FMOD' have diverged,
and have 1 and 141 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)

Changes to be committed:
```

and then I get a bunch of files in green (new and modified files).

Then I get this

```
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: FMOD/Metadata/Event/{0cf32ce5-99c4-475c-8341-43c26548e437}.xml
deleted: FMOD/Metadata/Event/{1f486936-3ba9-4c36-8435-97abae43e129}.xml
modified: FMOD/Metadata/Event/{2ebb0065-18d1-4768-ab74-08b78e92080f}.xml
deleted: FMOD/Metadata/Event/{5f56eb27-cd6d-42ae-824b-ee5def1e5e25}.xml
deleted: FMOD/Metadata/Event/{86691b51-29b7-4840-9f9b-11c2175f74dd}.xml

Untracked files:
(use "git add <file>..." to include in what will be committed)
FMOD/Metadata/AudioFile/{471d1e58-b7c0-4dd5-8ee7-4f5b1a3e1330}.xml
FMOD/Metadata/AudioFile/{504dcad3-5b0a-4dc1-ad29-691a095fcfa2}.xml
FMOD/Metadata/AudioFile/{5b92ba40-82fb-44e9-9746-290341ae4da8}.xml
FMOD/Metadata/AudioFile/{87269cc0-1162-4351-bc69-bbddd1192285}.xml
FMOD/Metadata/AudioFile/{cecfafda-ca87-422c-a116-9d8b790bb835}.xml
FMOD/Metadata/AudioFile/{cfacb069-6990-4117-8bb5-36aaca60a3c9}.xml
FMOD/Metadata/DAWAsset/{002409ab-0e65-4de8-9c04-a10ba7ed6e36}.xml
FMOD/Metadata/DAWAsset/{040dae51-8621-42c2-b4b2-b3ddaa21a08e}.xml
FMOD/Metadata/DAWAsset/{064401c2-3a1b-4652-8e62-8628848caeef}.xml
```

It suggest me to "git commit", but this still throws an error (haven't tried in Terminal, but in Sourcetree GUI it does, as I pointed out before)


author: Lucas Rei Ramos
body: Hello again! Your hint pointed me in the right direction! The problem was with the partial commit. It looks that I had some unstaged files. Staging them and committing worked, or so it seems!


author: Saxea _Flowie_
body: Nice! I suggest taking a short tutorial on git basics so you become more familiar with the common scenarios, otherwise it can be very frustrating. I said that from my own experience :).


author: Lucas Rei Ramos
body: Thanks! I did sone time ago, but lack of practice isn't helping. I remember having problems in the past trying to roll back to a previous commit and things like that. Will follow your advice.

Thanks again!


Tags: bitbucket-cloud

cloud

sourcetree