如何将已提交的更改上传到我的GitHub存储库? [英] How can I upload committed changes to my GitHub repository?
问题描述
我使用 clone
在GitHub上创建了我的存储库的本地副本.
I used clone
to create a local copy of my repository on GitHub.
我修改了一些文件.然后我做了: git commit -a
I modified a few files. Then I did:
git commit -a
现在我想将已提交的更改保存到GitHub存储库中.
And now I want to save my committed changes to the GitHub repository.
我该怎么做?
推荐答案
您推送您的更改:
git push origin master
将 master
替换为要推送的分支的名称(如果不同于master的话).
Replace master
with the name of the branch you want to push, if different from master.
如果分支是自您上次更新以来已更新,则更改可能会被拒绝.在这种情况下,您必须先拉远程分支上的最新更改:
In case the branch was updated since your last update, the changes may be rejected. In that case you have to pull the latest changes on the remote branch first:
git pull origin master
(可选)您可以使用以下方法将更改基于远程主服务器(这将阻止合并提交):
Optionally, you can rebase your changes on top of the remote master (this will prevent a merge commit), by using:
git pull origin master --rebase
这篇关于如何将已提交的更改上传到我的GitHub存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!