Search code examples
gitgithubrepositorygit-pushremote-repository

Pushing changes to branch other than main


I cloned a repo from github I made, I did some changes. My repo on github has 2 branches, main and dev. I want to push my changes to dev first and then main.

I ran:

git branch

while in the cloned (local) repo, giving me the output:

*main

I don't see my dev branch I made on github.

How can I push my changes to the dev branch?


Solution

  • Apparently,

    git branch dev
    git checkout dev
    git pull origin dev
    git push origin dev:dev
    

    worked.