1. Pull is not possible because you have unmerged files.
症状:pull的时候
$ git pull Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'
应该是因为local文件冲突了
解决方法:
引用――

1.pull会使用git merge导致冲突,需要将冲突的文件resolve掉 git add -u, git commit之后才能成功pull.
2.如果想放弃本地的文件修改,可以使用git reset --hard FETCH_HEAD,FETCH_HEAD表示上一次成功git pull之后形成的commit点。然后git pull.
注意:
git merge会形成MERGE-HEAD(FETCH-HEAD) 。git push会形成HEAD这样的引用。HEAD代表本地最近成功push后形成的引用。

就我的经验,有时候会莫名其妙地出现这种状况,而且Untracked files 还特别多(实际上自己可能只改了一两个文件),所以只好先保存好自己确定做出的local的修改,然后用git reset --hard FETCH_HEAD回到上次成功pull之后的点,然后再pull就没有问题了 2.You are not currently on a branch.
症状:有一次pull的时候又出现冲突,这回用“git reset --hard FETCH_HEAD”方法都不行了,出现:
$ git pull
You are not currently on a branch, so I cannot use any
'branch.<branchname>.merge' in your configuration file.
Please specify which remote branch you want to use on the command
line and try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details. 解决方法:
首先git checkout -b temp
其次git checkout master
即可恢复到master repository的状态,然后就可以pull了
------------------------------------------------------------------------------------------------------------
 3.git 报错原因汇总
$ git push origin master
To git@github.com:qzmly100/repository-.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:qzmly100/repository-.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.

是不是在不同的机器上上做了提交??

远程分支上存在本地分支中不存在的提交,往往是多人协作开发过程中遇到的问题,可以先fetchmerge,也就是pull,把远程分支上的提交合并到本地分支之后再push

如果你确定远程分支上那些提交都不需要了,那么直接git push origin master -f,强行让本地分支覆盖远程分支。。。

 本回答由网友推荐

git提交的问题的更多相关文章

  1. git提交时支持文件名大小写的修改

    在windows环境下,git提交文件时,默认对文件名大小写不敏感,若修改了文件名字的大小写,可能会导致提交时没有记录,文件名修改不成功.网上搜集了几种解决方法,现总结下: 1. 修改git conf ...

  2. 怎么修改git提交过的内容

    git修改历史提交   Git使用amend选项提供了最后一次commit的反悔.但是对于历史提交呢,就必须使用rebase了. git rebase -i HEAD~3 表示要修改当前版本的倒数第三 ...

  3. Git提交引用和引用日志

    转载自:https://github.com/geeeeeeeeek/git-recipes/wiki/5.5-Git%E6%8F%90%E4%BA%A4%E5%BC%95%E7%94%A8%E5%9 ...

  4. 设置Git提交时不用输入用户名和密码

    在用git提交时代码至github上时每次都要输入用户名和密码,当提交操作较为频繁时非常不方便,可以按下文中的介绍,设置成提交时不用输入用户名和密码: 1.在当前库下,已经运行过 git remote ...

  5. 解决git提交问题error: The requested URL returned error: 403 Forbidden while accessing

    git提交代码时,出现这个错误"error: The requested URL returned error: 403 Forbidden while accessing https&qu ...

  6. 写得好 git 提交信息

    编写好 git 提交信息 提交信息 我们作出答复,更改将提交相关信息,这些信息通常被认为是重要的信息会小心留下应该离开,你为什么需要这个提交实例,提交解决任何问题. 我们需要良好的信息组织,虽然后来, ...

  7. 老鸟都应该注意的git 提交规范

    不知道大家有没有看过自己项目的git 提交信息-----我看过好多次 ,不忍直视  然后提醒一起的小伙伴 :大家规范点 信息要详细, 过段时间再看下 ,还是一样. 相信很多猿都有这样的感受,对于垃圾的 ...

  8. git学习四:eclipse使用git提交项目

    支持原创:http://blog.csdn.net/u014079773/article/details/51595127 准备工作: 目的:eclipse使用git提交本地项目,提交至远程githu ...

  9. 使用git提交到github,每次都要输入用户名和密码的解决方法

    使用git提交文件到github,每次都要输入用户名和密码,操作起来很麻烦,以下方法可解决,记录以下. 原因:在clone 项目的时候,使用了 https方式,而不是ssh方式. 默认clone 方式 ...

  10. git提交代码到github

    前言:转载请注明出处:http://blog.csdn.net/hejjunlin/article/details/52117504 git提交代码到github 命令汇总: git init git ...

随机推荐

  1. Oracle中根据当前时间和活动类型去数据库查询活动id

    活动类型默认是1,代表邀请好友 select * from t_invite_activityinfo twhere sysdate >= t.begintime and sysdate< ...

  2. go语言判断末尾不同的长字符串的方法

    判断两种末尾不同的长字符串,在使用正则表达式的基础上,进一步利用好字符串的方法,最后成功对问题进行解决. package utils import ( "io/ioutil" &q ...

  3. i2c_client 几种实例化方法

    http://blog.csdn.net/lugandong/article/details/48092397

  4. 1.7.8使用return 停止线程

    package com.cky.thread; /** * Created by edison on 2017/12/3. */ public class MyThread12 extends Thr ...

  5. How to transfer developer profile to one mac to another mac

    Export developer profile from old mac. In the Xcode Organizer, select your team in the Teams section ...

  6. hdu 4901 划分序列使异或和==且和

    http://acm.hdu.edu.cn/showproblem.php?pid=4901 给定一个序列,要求选出两个集合,S和T,要求S中选中的元素的下标都要小于T中元素的下标.并且说S中元素的异 ...

  7. Javascript 对象创建多种方式 原型链

    一.对象创建 1.new Object 方式 直接赋上属性和方法 var obj = new Object(); obj.name = '娃娃'; obj.showName = function(){ ...

  8. scikit-FEM-例2-用Morley元在方形区域上解板弯曲问题

    """ Author: kinnala Solve the Kirchhoff plate bending problem in a unit square with c ...

  9. mac系统下安装Windows(7,8,10都一样的步骤)

    1.下载纯净版window10镜像文件(ISO) 注意:必须是纯净版,不是ghost版     2.打开bootcamp软件(位置:launchpad-其他) 注意:硬盘不要分区,若分过区,请合并. ...

  10. UNIGUI接收普通消息和被动回复用户消息

    接收普通消息和被动回复用户消息 用户发送消息给公众号时(或某些特定的用户操作引发的事件推送时),会产生一个POST请求,开发者可以在响应包(Get)中返回特定XML结构,来对该消息进行响应(现支持回复 ...