gitgithubrepositorygithub-for-windows

Can't able to merge branch to main branch in github


I developed a github repository with empty main in GitHub. Then i created local repo in git and done basic operations to push...

git init

for new empty repo

git add . 

for adding all files in local repo

git commit -m "first update"
git add remote origin <github repo link>.git

I've tried merge and rebase too....

git merge origin/main
git rebase origin/main

still it was unable to merge it please help with a solution


Solution

  • You can't merge or rebase initially, just push with -u flag which set upstream to origin/main

    git init
    git add .
    git commit -m "first commit"
    git branch -M main
    git remote add origin $(repolink).git
    git push -u origin main
    

    Next push use git push origin main