Unable to push changes to master

hello again. Im trying to do the push of a programming problem to the training repo doing the following steps in Netbeans ide:

  • clone master branch
  • create and switch to my branch ( Cha0smagick)
  • repository browser ->remote repositories-> master merge. This to merge all the changes in the repo.
  • add link in OTHERS.lst in the last line, followed by a blank line for the eof
  • add the programming script to netbeans ( copy and paste into the netbeans repo ide)
  • commit

Until this point everything perfect. then when im going to do the push to the remote repo, i select my local branch Cha0smagick and then the first problem appears:

The c in red right to my branch mean that a pull of the remote Cha0smagick is needed. i dont know what that means. Then, the second problem emerges:

The outputs for this problem are:

Remote Repository Updates
Branch Update : Cha0smagick
Old Id : 04c491e46ec8390ada7e2ccd448e1ac02a82923a
New Id : adfeb2755d6976559878abc19c176b3e8fbe8746
Result : REJECTED_NONFASTFORWARD

i was reading about it in internet and the web suggest to do the 3rd step i do in my inicial steps.

  • repository browser ->remote repositories-> master merge. This to merge all the changes in the repo.

but after doing it one more time, nothing happens. Can you help me?
I found myself in need to ask since I have been trying to solve it for several hours and I have not been able to.

1 Like

There’s no need of master merge since we use a mono-repo fast foward approach. Use git pull instead using the command line.

I strongly suggest you to manage git and all commands from a terminal instead of the IDE, because it has several limitations on what you can and cannot do.

From this point I’m assuming you’re using the command line instead of the IDE and you’re working on your branch, then you can try using:

  1. git branch -u origin/master
  2. git pull
  3. git rebase
  4. git push origin mybranch

If the issue persists after this, please update the post with further information, detailing the commands and outputs.

Regards

As we recommend in the documentation, you should work with git CLI directly. This is important to understand many mechanisms that we use internally.

There are so many IDEs that for us is impossible to help you with all the possibilities.

1 Like

I get this error when i put the git rebase:

error: cannot rebase: You have unstaged changes.
error: Please commit or stash them.

I tried to do

git commit 

but it doesnt work. also i tried

git fetch
git rebase -p origin/master

But the same error appears. Then i tried

git stash

and it seems to work, but when I put:

git push origin Cha0smagick

This appears:

 git push origin Cha0smagick
To https://gitlab.com/autonomicmind/training.git
 ! [rejected]            Cha0smagick -> Cha0smagick (non-fast-forward)
error: failed to push some refs to 'https://Cha0smagick@gitlab.com/autonomicmind/training.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

How can i merge the remote changes? it seems to be the solution.

Try deleting your remote branch or forcing the push by adding - f flag at the end of the command

1 Like

thanks. -f make me able to do the push to git push origin Cha0smagick