Git merge is not possible because I have unmerged files
Git merge is not possible because I have unmerged files
I repeatedly had the same challenge sometime ago. This problem occurs mostly when you are trying to pull from the remote repository and you have some files on your local instance conflicting with the remote version, if you are using git from an IDE such as IntelliJ, you will be prompted and allowed to make a choice if you want to retain your own changes or you prefer the changes in the remote version to overwrite yours. If you dont make any choice then you fall into this conflict. all you need to do is run:
git merge --abort # The unresolved conflict will be cleared off
And you can continue what you were doing before the break.
The error message:
merge: remote/master – not something we can merge
is saying that Git doesnt recognize remote/master
. This is probably because you dont have a remote named remote. You have a remote named origin.
Think of remotes as an alias for the url to your Git server. master
is your locally checked-out version of the branch. origin/master
is the latest version of master
from your Git server that you have fetched (downloaded). A fetch
is always safe because it will only update the origin/x version of your branches.
So, to get your master
branch back in sync, first download the latest content from the git server:
git fetch
Then, perform the merge:
git merge origin/master
…But, perhaps the better approach would be:
git pull origin master
The pull
command will do the fetch
and merge
for you in one step.
Git merge is not possible because I have unmerged files
It might be the Unmerged paths that cause
error: Merging is not possible because you have unmerged files.
If so, try:
git status
if it says
You have unmerged paths.
do as suggested: either resolve conflicts and then commit or abort the merge entirely with
git merge --abort
You might also see files listed under Unmerged paths, which you can resolve by doing
git rm <file>
Related posts on Git :
- git flow – Gitflow feature vs bugfix branch naming
- git – Alternatives to GitHub Pages?
- confusion about git rev-list
- git – What does the checkout step in circle ci do?
- What is the difference between IntelliJs Shelve and Git stash?
- git – destination path already exists and is not an empty directory
- git – fatal: This operation must be run in a work tree
- git – Push rejected, failed to compile Node.js app heroku
- git – SourceTree keeps asking for Github password