将git存储库中的提交添加到GitHub

时间:2015-12-29 11:02:11

标签: git github

我已经更改了本地存储库中的一个文件,并且我在git中添加了更改并保存了提交。

现在我想发送这些更改并提交到GitHub中的项目。

GitHub中的存储库存在,但现在我可以添加所有更改和提交。

我该怎么做?

2 个答案:

答案 0 :(得分:4)

//  add all your files
git add .

// commit all your changes
git commit -m "message"

// Make sure you have the latest code in case someone else has committed changes
git pull origin <branch name>

// Update github repository with your latest code
git push origin <branch name>

enter image description here

答案 1 :(得分:0)

作为第一个命令类型;

git add *

然后,写一个提交消息如下:

git commit -m 'here the message'

最后,在联机存储库中推送本地存储库的提交:

git push origin master

可能这最后一个命令是你唯一需要的命令。如果发生错误,您需要输入命令:git pull然后git push

相关问题