2012-12-03 68 views
1
Windows PowerShell 
Copyright (C) 2009 Microsoft Corporation. All rights reserved. 

C:\Users\Allen\Documents\GitHub\project2-pd7 [master]> git status 
# On branch master 
# Your branch is ahead of 'origin/master' by 5 commits. 
# 
nothing to commit, working directory clean 
C:\Users\Allen\Documents\GitHub\project2-pd7 [master]> git push 
Counting objects: 36, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (15/15), done. 
Writing objects: 100% (30/30), 3.93 KiB, done. 
Total 30 (delta 8), reused 1 (delta 0) 
error: unpack failed: index-pack abnormal exit 
To https://github.com/stuycs-ml7/project2-pd7.git 
! [remote rejected] master -> master (unpacker error) 
error: failed to push some refs to 'https://github.com/stuycs-ml7/project2-pd7.git' 

我仍然试图用github找到我的海腿,但这些不断的问题正在令我失望。任何人都可以在普通话中解释解决方案,这样我就能理解了吗?Github分支提前5个提交,如何解决?

回答

1

自上次结帐/拉出以来,班级中的其他一些学生推送了一些修订。

由于hd1指出,你最好的选择是git pull,这可能会创建一个合并提交,之后你可能不得不明确git commit合并。我更喜欢git pull --rebase在运行之前将更改线性化git push

从命令行运行git log --graph以获得本地存储库当前状态的良好可视化。

做一个git fetch下拉远程分支,而不尝试合并或重定目前的变化。这将允许您检查远程存储库的状态git log --graph origin/master

+0

git pull返回已经是最新的。我不确定你提交合并的意思,所以我刚输入(git add。)和(git commit -m“”)。我认为我做了一些错误,因为现在它说: 你的分支在6次提交之前领先于'origin/master'。 – user1869558

0

尝试git pull之前git push

+0

git pull返回:使用'递归'策略进行合并 – user1869558

+0

git push返回与以前相同的错误。 – user1869558

2

您的历史与远程分支的历史有所不同。自从您上次登录git pull以来,可能有人已将提交提交给远程分支。该解决方案可以是:

git pull 

git pull --rebase 

后来试图让他们出现在分支的末端,重建基础上的远程分支的历史最高重写你的提交。前者在您的远程分支历史记录之间做了简单的合并。