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

37 Views Asked by At

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

1

There are 1 best solutions below

0
Yuvaraj M On BEST ANSWER

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