【Git】How to fix: fatal: Exiting because of an unresolved conflict on GitHub

Abstract

I tried to push my repository to Git, but because of the error: fatal: Exiting because of an unresolved conflict, it failed. So, I wrote down the solution how to fix this error on this article.

I'm not English native speaker, so I'm sorry if English grammar is weird. ;)

Index

  • Abstract
  • Index
  • Environment
  • What I tried
  • Solution
  • Conclusion

Environment

・mac OS Catarina 10.15.1(2017)
・Rails 6
・heroku

What I tried

I tried to pull git local repository to master branch on GitHub.

master-branch
$ git pull origin master 

But the error below happens:

    error: Pulling is not possible because you have unmerged files.
    hint: Fix them up in the work tree, and then use 'git add/rm <file>'
    hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict. 

I'm not used to use git, so I tried merge or revert git branch. But it doesn't work well.

By the way, by tapping the command below,
git log --oneline --graph --all
you can get graphical branch tree.

① pull mater branch
% git pull origin master   
error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.

② Type 'git status', and see the circumstance
% git status            
On branch master
You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

③See the file path in red 

Changes to be committed:

modified:   app/views/layouts/application.html.erb

Unmerged paths:
  (use "git add <file>..." to mark resolution)

both modified:   app/assets/stylesheets/home.scss


④ Add & commit file in red
% git add  app/assets/stylesheets/home.scss
% git commit -m " app/assets/stylesheets/home.scss"
[master 3f52760]  app/assets/stylesheets/home.scss

⑤ Type 'git status', and see the circumstance
% git status                                       
On branch master
nothing to commit, working tree clean

I could pull master branch.

Coclusion

If you are Git beginner, you will be confused, and you maybe don't know what to do next. But, at first, you have to find the circumstance of git repository.

コメント

このブログの人気の投稿

【Unity】シーンギズモがデフォルトで表示されない時

【Swift4】argument passed to call that takes no arguments の解決策

【Swift4】iOSシミュレータでカメラとフォトライブラリが起動しない?試してみてわかったこと