注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

还东国的博客

行之苟有恒,久久自芬芳

 
 
 

日志

 
 

Git使用之十—— 误提交.o 和.so文件引起的无法PULL和PUSH的解决方法  

2014-11-27 11:57:13|  分类: 环境安装使用 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

Git使用之十—— 误提交.o .so文件引起的无法PULLPUSH的解决方法

同事使用git add误把下面的一些中间文件和库文件提交到了GIT库上,这几天GIT库真是多事之秋,才IP乱了恢复好,又出这事,结果是在另外一台机器上PULL下来后,发现无法编译了。

原因很简单,一些必要的配置,如对C++11和一些库的设置都没有了。然后发现另外一个同事的PULL后也无法编译。

首先想恢复GIT,想了N种办法也没弄成,只好恢复到原来一个较老的版本,也亏得最近很少改动。这时候儿,好戏又来了。

用一台机器测试没有什么问题,就从另外一个机器上下,结果发现GIT不让更新:

大概意思是说:你的本地库与GIT远端的.o.SO不一致。需要提交一下。

好吧,就提交了一下。更悲催了。PUSH的时候儿,直接拒绝。再PULL,还让提交,无语,进了死循环,没办法,折腾了半天,还是把本地文件夹改了个名字,然后重新Clone下来,编译过了。

今天其它同事也下来没有什么问题,于是对虚拟的一台电脑进行PULL,重复出现上面的问题。但其下面提供了这样的消息:

Use –catch –f 什么的删除或者恢复的意思(内容找不到了,没办法拷贝到这里,终端的显示太小了。

然后就用git rm –rf 强制删除:

fjf@fjf-virtual-machine:~/IKEmbX00/Code/SocketComm$ git rm -rf obj

rm 'Code/SocketComm/obj/autoMachine.o'

rm 'Code/SocketComm/obj/netClient.o'

rm 'Code/SocketComm/obj/netClientPoll.o'

rm 'Code/SocketComm/obj/netClientSelect.o'

rm 'Code/SocketComm/obj/netServer.o'

rm 'Code/SocketComm/obj/socketAPI.o'

rm 'Code/SocketComm/obj/socketBase.o'

rm 'Code/SocketComm/obj/socketCon.o'

rm 'Code/SocketComm/obj/socketInterfaceAPI.o'

rm 'Code/SocketComm/obj/stdWait.o'

fjf@fjf-virtual-machine:~/IKEmbX00/Code/SocketComm$ git status

# On branch master

# Your branch is behind 'origin/master' by 9 commits, and can be fast-forwarded.

#

# Changes to be committed:

#   (use "git reset HEAD <file>..." to unstage)

#

#       deleted:    obj/autoMachine.o

#       deleted:    obj/netClient.o

#       deleted:    obj/netClientPoll.o

#       deleted:    obj/netClientSelect.o

#       deleted:    obj/netServer.o

#       deleted:    obj/socketAPI.o

#       deleted:    obj/socketBase.o

#       deleted:    obj/socketCon.o

#       deleted:    obj/socketInterfaceAPI.o

#       deleted:    obj/stdWait.o

#

# Changes not staged for commit:

#   (use "git add <file>..." to update what will be committed)

#   (use "git checkout -- <file>..." to discard changes in working directory)

#

#       modified:   ../../03 Code/SocketComm/test/libsocketcomm.so

#       modified:   ../../03 Code/SocketComm/test/main.cpp

#       modified:   ../IrisAppLib/lib/libIrisManager.so

#       modified:   lib/libsocketcomm.so

#       modified:   test/libsocketcomm.so

#       modified:   test/mytest

#

# Untracked files:

#   (use "git add <file>..." to include in what will be committed)

#

#       ../../06 Other/soci/unpackage-soci/soci-package/

#       ../ikembx00-build-desktop-Qt_4_8_1___PATH________/

#       ../ikembx00UI/ikembx00.pro.user

在这里就别提了,又画蛇添足的git add –u了一下,结果又提交了两个没用的文件,前面的事儿吓着了,赶紧用前文提到的git add –i恢复过来。然后commit了,也成功了。

fjf@fjf-virtual-machine:~/IKEmbX00/Code/SocketComm$ git commit -m"GIT 恢复"

[master 33a54e1] GIT 恢复

 13 files changed, 0 insertions(+), 0 deletions(-)

 delete mode 100644 Code/SocketComm/lib/libsocketcomm.so

 delete mode 100644 Code/SocketComm/obj/autoMachine.o

 delete mode 100644 Code/SocketComm/obj/netClient.o

 delete mode 100644 Code/SocketComm/obj/netClientPoll.o

 delete mode 100644 Code/SocketComm/obj/netClientSelect.o

 delete mode 100644 Code/SocketComm/obj/netServer.o

 delete mode 100644 Code/SocketComm/obj/socketAPI.o

 delete mode 100644 Code/SocketComm/obj/socketBase.o

 delete mode 100644 Code/SocketComm/obj/socketCon.o

 delete mode 100644 Code/SocketComm/obj/socketInterfaceAPI.o

 delete mode 100644 Code/SocketComm/obj/stdWait.o

 rewrite Code/SocketComm/test/libsocketcomm.so (69%)

 mode change 100644 => 100755

 

这时候GIT PUSH了下,又给拒绝了,然后抱着一点希望git pull了下,OK了。

fjf@fjf-virtual-machine:~/IKEmbX00/Code/SocketComm$ git push

To git@10.2.1.115:IKEmbX00

 ! [rejected]        master -> master (non-fast-forward)

error: failed to push some refs to 'git@10.2.1.115:IKEmbX00'

To prevent you from losing history, non-fast-forward updates were rejected

Merge the remote changes (e.g. 'git pull') before pushing again.  See the

'Note about fast-forwards' section of 'git push --help' for details.

fjf@fjf-virtual-machine:~/IKEmbX00/Code/SocketComm$ git pull

Removing Code/ikembx00UI/image/jtbq_024.ico

Removing Code/databaseLib/IKDatabaseLib/libdatabase.so

Removing Code/databaseLib/IKDatabaseLib/libdatabase.a

Merge made by the 'recursive' strategy.

 07 Reference/2014_11_14_eclipse.png           |  Bin 0 -> 222502 bytes

 Code/common.cpp                               |   48 ++-

 Code/common.h                                 |    1 +

 Code/databaseLib/IKDatabaseLib/libdatabase.a  |  Bin 97636 -> 0 bytes

 Code/databaseLib/IKDatabaseLib/libdatabase.so |  Bin 65050 -> 0 bytes

 Code/ikembx00UI/capturephoto.cpp              |    3 +-

 Code/ikembx00UI/daemon.cpp                    |   90 ++++++

 Code/ikembx00UI/daemon.h                      |    7 +

 Code/ikembx00UI/datamanage.cpp                |   73 ++++-

 Code/ikembx00UI/datamanage.h                  |    9 +

 Code/ikembx00UI/detailpersoninfo.cpp          |    2 +-

 Code/ikembx00UI/detailpersoninfo.ui           |   50 +--

 Code/ikembx00UI/dialogabout.ui                |    4 +-

 Code/ikembx00UI/dialogidentify.cpp            |    2 +-

 Code/ikembx00UI/dialogidentify.ui             |   53 ++--

 Code/ikembx00UI/ikembx00.pro                  |   12 +-

 Code/ikembx00UI/ikembx00.qrc                  |    2 +

 Code/ikembx00UI/ikxmlhelper.cpp               |  401 +++++++++++++++++++++++++

 Code/ikembx00UI/ikxmlhelper.h                 |  288 ++++++++++++++++++

 Code/ikembx00UI/image/arrorDown.ico           |  Bin 0 -> 5534 bytes

 Code/ikembx00UI/image/backArrow.ico           |  Bin 0 -> 90022 bytes

 Code/ikembx00UI/image/jtbq_024.ico            |  Bin 99678 -> 0 bytes

 Code/ikembx00UI/main.cpp                      |   32 ++

 Code/ikembx00UI/mainwindow.cpp                |    2 +-

 Code/ikembx00UI/personmanage.cpp              |   10 +-

 Code/ikembx00UI/personmanage.h                |    2 +

 Code/ikembx00UI/shutdown.ui                   |    9 +-

 Code/ikembx00UI/simutouchevent.cpp            |   98 ++++++

 Code/ikembx00UI/simutouchevent.h              |    4 +

 Code/ikembx00UI/syssettings.cpp               |   72 +++--

 Code/ikembx00UI/syssettings.ui                |    2 +-

 Code/ikembx00UI/wakescreen.cpp                |   32 ++

 Code/ikembx00UI/wakescreen.h                  |    7 +

 Code/shell/daemon_ikemb100.sh                 |   56 ++++

 34 files changed, 1274 insertions(+), 97 deletions(-)

 create mode 100644 07 Reference/2014_11_14_eclipse.png

 delete mode 100644 Code/databaseLib/IKDatabaseLib/libdatabase.a

 delete mode 100644 Code/databaseLib/IKDatabaseLib/libdatabase.so

 create mode 100644 Code/ikembx00UI/daemon.cpp

 create mode 100644 Code/ikembx00UI/daemon.h

 create mode 100644 Code/ikembx00UI/ikxmlhelper.cpp

 create mode 100644 Code/ikembx00UI/ikxmlhelper.h

 create mode 100755 Code/ikembx00UI/image/arrorDown.ico

 create mode 100644 Code/ikembx00UI/image/backArrow.ico

 delete mode 100644 Code/ikembx00UI/image/jtbq_024.ico

 create mode 100644 Code/ikembx00UI/simutouchevent.cpp

 create mode 100644 Code/ikembx00UI/simutouchevent.h

 create mode 100644 Code/ikembx00UI/wakescreen.cpp

 create mode 100644 Code/ikembx00UI/wakescreen.h

 create mode 100755 Code/shell/daemon_ikemb100.sh

fjf@fjf-virtual-machine:~/IKEmbX00/Code/SocketComm$ git pull

Already up-to-date.

真是无语了,用得还是太少。

  评论这张
 
阅读(1302)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017