Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git remote repository contains commits unmerged into the local branch

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.

Screen:

enter image description here

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.
like image 730
james Avatar asked Jul 30 '14 02:07

james


3 Answers

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.

The following window opens up:

enter image description here

Steps:

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

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

like image 76
james Avatar answered Nov 10 '22 07:11

james


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

like image 11
v-system Avatar answered Nov 10 '22 08:11

v-system


Don’t use git pull, use git fetch, then git merge, then git commit and then git push.

FYI: http://longair.net/blog/2009/04/16/git-fetch-and-merge/

like image 9
Daniel De León Avatar answered Nov 10 '22 06:11

Daniel De León