Push local branch into master

Issue

I have my Github project.
My idea is to have:

  • Origin: contain latest prod version
  • Master: contain all work changes before prod
  • all local branch

I create new local branch called logFaq, I commit the code, and I want to push my logFaq branch into remote master.

What I tried is

> git push master logFaq

fatal: 'master' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

How I can solve it?
I want only to merge my local branch to remote master

If I perform from my local branch :

> git log
commit fcd2d97be1d69d9e3e79ca09ff725ec3eb083203 (HEAD -> logFaq)
Author: gdelle <[email protected]>
Date:   Fri Aug 6 09:05:56 2021 +0200

    aggiunto log apertura/chiusura faq

commit 4a4209b9e74618d62938503d4bf7934325a45541 (origin/master, origin/main, origin/HEAD, master, main)
Author: gdelle <[email protected]>
Date:   Fri Aug 6 07:56:31 2021 +0200

    my first commit

Solution

I’d suggest you start by reading any of the most basic guides before using git. You can find many good resources here for a start.

For the question at hand, something along the lines of

git checkout master
git merge <your-branch-name-here>
git push

But beware of doing this without understanding what’s going on, maybe try some commands in a sandbox repo a couple of times if needed. And of course if the repo is shared, be sure to know what kind of workflow is agreed upon.

Answered By – Romain Valeri

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published