I have set up a pet project in a remote repository on gitlab.com and I have the local repo in a folder on MacOS. My SSH key on gitlab.com is setup OK and communications work alright.
I edit/test/debug the code on MacOS and have no problems doing git add/commit
from CLI in a simple terminal.
But issuing a git push
after some development seems not change directly the code in the remote directory. By this I mean that if I open a web browser, go to my project page with the list of all files and click on any of them, I still see the code that was there before the "git push".
And, at the top of this page I see a greenish box saying "You pushed to master at xxx/yyy 20 seconds ago" with a blue button saying "Create merge request".
So I need to generate a "merge request", assign it to myself, and finally accept it.
Is this the only way to go, or can I configure gitlab to avoid this step?
I know that big projects with many developers in different knowledge tiers need this approach, but on my project, there is only me working.
I tried reading gitlab documentation, but I find it extremely complex, and full of concepts unclear to me, even if I am reasonably familiar with code management systems, and worked for many years with CVS and subversion.
From the comments we know that the issue is that you have two different branches, main
and master
, and you only need one of them. It seems Gitlab is currently configured with main
as your default branch, and locally you are using master
. Since you stated you are the only user of the project and you do not wish to use the Merge Request functionality, here are two possible ways to fix it:
master
instead of main
. After that, simply delete the remote branch main
. (And if you have a local copy of main
you can delete that also.) Now you'll have just one branch called master
and when you push you'll update it as desired.main
. Then hard reset it to master
: git reset --hard master
. Then delete local and remote versions of master
. Now you will only have main
. (Tip: make sure you have a clean git status
before performing a hard reset.)Regardless of which option you choose, afterwards, if you get an error when pushing directly to the remote branch, then you may also need to remove branch protection.
Side Note: there are other options as well, for example you could point your local master
to origin/main
, but I don't recommend this because it could cause confusion.