I wanted to merge a branch into master and followed the steps gitlab told me to do.
- git fetch origin
- git checkout -b "testbranch" "origin/testbranch"
- git fetch origin
- git checkout "origin/master"
- git merge –no-ff "testbranch"
- Here I fixed all the conflicts
- git commit -m "merged"
- git push origin "master"
The problem is that when trying to push to master it will say that it is already uptodate. Also the git console doesn’t say that I am on the master branche but on some number "61684d2…".
How can I push my changes back to master?
>Solution :
When you do git checkout origin/master
, you are starting to run locally from a remote branch…. this is on detached HEAD
state. If this is really the way you merge/push, then you need to specify where to push when pushing:
git push origin @:master