git push提示以下错误,再次执行git pul打开冲突文件乱码神马情况?

$ git push
To github.com:wanghuiwiki/shop.git
 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'github.com:wanghuiwiki/shop.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Administrator@WIN-O379IL963GN MINGW64 ~/Desktop/shop/withssh/shop (main)
$ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 801 bytes | 61.00 KiB/s, done.
From github.com:wanghuiwiki/shop
   853f44a..3ae907b  main       -> origin/main
Auto-merging readme.txt
CONFLICT (content): Merge conflict in readme.txt
Automatic merge failed; fix conflicts and then commit the result.

阅读 2.3k
2 个回答
From github.com:wanghuiwiki/shop
   853f44a..3ae907b  main       -> origin/main
Auto-merging readme.txt
CONFLICT (content): Merge conflict in readme.txt
Automatic merge failed; fix conflicts and then commit the result.

其实就是有冲突了,所以自动合并失败了需要你去解决冲突然后再提交。

乱码的问题呢,则是你的编码问题了,你直接用IDE去同步一下吧。
如果你对命令行不是特别熟练的话,直接用IDE自带的可视化Git工具就可以很方便的解决这些问题了,一般合并出现问题会直接弹窗提示你需要手动操作,然后会在IDE内直接打开冲突解决视图。

比如说这样,然后通过点选就可以手动处理冲突了:
image.png

这个和git没关系. 是你自己文件的编码问题导至的.

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题