git 远程存储库包含未合并到本地分支的提交 [英] git remote repository contains commits unmerged into the local branch

查看:58
本文介绍了git 远程存储库包含未合并到本地分支的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 netbeans IDE 中使用 git.我想更改我最近所做的提交的提交消息.我这样做了,选中了 amend last commit 复选框并将其提交到我的本地存储库.当我将此提交推送到我的 github 存储库时,出现错误:git 远程存储库包含未合并到本地分支的提交.打开输出以查看更多信息. 我该如何解决这个问题?我是源代码管理的新手.我只想对我当前的项目进行非常基本的版本控制.请告诉我如何解决这个问题.

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.

屏幕:

输出消息:

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.

推荐答案

我又看了一遍错误信息,觉得应该把本地分支合并到远程分支.我在 IDE 中环顾四周以找到这些选项.当我尝试时,我很幸运:<代码>项目>右键单击 >git >存储库浏览器.

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.

打开以下窗口:

步骤:

  1. 远程分支 > 右键单击​​ > 合并修订.然后你会在local旁边看到remote的hash.

  1. Remote branch > right click > merge revision. Then you will see the hash of remote next to local.

项目 > 右键单击​​ > Git > 远程 > 推送.这会将您的本地分支代码推送到远程仓库.

Project > Right click > Git > Remote > Push. This will push your local branch code to remote repo.

这篇关于git 远程存储库包含未合并到本地分支的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆