[英]How to merge a branch to main branch in Github?
I have my code on my local computer.我的本地计算机上有我的代码。 I created a github repository.
我创建了一个 github 存储库。 I wanted to upload my local code to this remote github repository.
我想将我的本地代码上传到这个远程 github 存储库。 This is what I did on terminal:
这是我在终端上所做的:
Then I type:然后我输入:
>git init
>git add .
>git commit -m "First commit"
>git remote add origin https://github.com/usergithub/repository_name.git
Then I went to my github repository and I saw a new branch:然后我去了我的 github 存储库,我看到了一个新分支:
So I click on the green button to make a pull request:所以我点击绿色按钮发出拉取请求:
But there is nothing there I can do to merge these 2 branches?但是我无法合并这两个分支吗?
How can I merge the branch to my main project?如何将分支合并到我的主项目?
I tried different stuff from the terminal:我从终端尝试了不同的东西:
git push --force origin main
But I get this error message:但我收到此错误消息:
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/usergithub/repository_name.git'
I hope the master
branch contains all of your pushed changes Steps to merge your branch我希望
master
分支包含您所有推送的更改合并您的分支的步骤
main
main
master
master
main
main
Now master
is merged in main
branch and main
branch contains all the changes of master branch.现在
master
合并到main
分支中, main
分支包含 master 分支的所有更改。
Or you can go to Pull Request
tab and click on the Pull request
you have created then scroll down you'll able to see the Merge Pull Request
Button.或者您可以 go 到
Pull Request
选项卡并单击您创建的Pull request
然后向下滚动您将能够看到Merge Pull Request
按钮。 On clicking that button it will merge your branch into main
branch.单击该按钮后,它会将您的分支合并到
main
分支中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.