git 远程存储库包含未合并到本地分支的提交
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25027653/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git remote repository contains commits unmerged into the local branch
提问by james
I am using git inside netbeans IDE. I wanted to change the commit message for the most recent commit I had made. I did that, checked the amend last commit
checkbox and committed it to my local repository. When I push this commit to my github repo, I get the error: git remote repository contains commits unmerged into the local branch. open output to see more information.
How do I fix this ? I am new to source control. I only want to do very basic version control with my current project. Please tell me how to fix this.
我在 netbeans IDE 中使用 git。我想更改我最近所做的提交的提交消息。我这样做了,选中了amend last commit
复选框并将其提交到我的本地存储库。当我将此提交推送到我的 github 存储库时,出现错误:git remote repository contains commits unmerged into the local branch. open output to see more information.
如何解决此问题?我是源代码管理的新手。我只想对我当前的项目进行非常基本的版本控制。请告诉我如何解决这个问题。
Screen:
屏幕:
Output message:
输出消息:
git branch
git remote -v
setting up remote: origin
git submodule status
git push https://github.com/double-whammy/netbeans_affablebean.git refs/heads/master:refs/heads/master
Remote Repository Updates
Branch Update : master
Old Id : id1
New Id : id2
Result : REJECTED_NONFASTFORWARD
Local Repository Updates
Branch Update : origin/master
Old Id : id1
New Id : id2
Result : NOT_ATTEMPTED
==[IDE]== Pushing - AffableBean finished.
回答by james
I read the error message once again and thought that I should merge the local branch into remote branch. I looked around in the IDE to find these options. I got lucky when I tried:
Project > right click > Git > repository browser
.
我再次阅读错误信息,认为我应该将本地分支合并到远程分支中。我在 IDE 中环顾四周以找到这些选项。当我尝试时,我很幸运:
Project > right click > Git > repository browser
.
The following window opens up:
将打开以下窗口:
Steps:
脚步:
Remote branch > right click > merge revision. Then you will see the hash of remote next to local.
Project > Right click > Git > Remote > Push. This will push your local branch code to remote repo.
远程分支 > 右键单击 > 合并修订。然后您将在本地旁边看到远程的哈希值。
项目 > 右键单击 > Git > 远程 > 推送。这会将您的本地分支代码推送到远程仓库。
回答by v-system
Realize a pull. Then a window with the option 'merge' will appear. Do a merge and try to push it again.
实现拉。然后会出现一个带有“合并”选项的窗口。进行合并并尝试再次推送它。
Sorry for my english level
对不起我的英语水平
回答by Daniel De León
Don't use git pull, use git fetch, then git merge, then git commit and then git push.
不要使用 git pull,先使用 git fetch,然后是 git merge,然后是 git commit,然后是 git push。
FYI: http://longair.net/blog/2009/04/16/git-fetch-and-merge/
仅供参考:http: //longair.net/blog/2009/04/16/git-fetch-and-merge/
回答by Viv Mendes
Right click your project > Git > Remote > fetch Right click your project > Git > Branch/ tag > Merge Revision Click merge Now u should be able to do the push...
右键单击您的项目 > Git > Remote > fetch 右键单击您的项目 > Git > Branch/ tag > Merge Revision 单击 merge 现在您应该能够执行推送...
回答by Aman Lahariya
If you can not see the file under remote in the git repository browser then first you need to pull in order to solve the above problem.
Steps:
1.Right click project > Git > Remote > Pull > then select merge option.
2.Right click project > Git > Remote > Push.
The problem should be solved by now :-)
如果在git仓库浏览器中无法看到remote下的文件,那么首先需要pull才能解决上述问题。
步骤:
1. 右键单击项目 > Git > Remote > Pull > 然后选择合并选项。
2.右键项目> Git>远程>推送。
这个问题现在应该解决了:-)
回答by chikitin
I would delete the repository. Recreate the repository. Please don't commit anything. Then push it after adding and committing inside NetBeans. Remember, you can create README.md, anything later.
我会删除存储库。重新创建存储库。请不要做任何事情。然后在 NetBeans 内部添加和提交后推送它。请记住,您可以稍后创建 README.md。