如何将您的更改推送到 Github 上的分叉回购?

How to push your changes into a forked repo on Github?

我将从一些详细的背景信息开始:​​

通常在我们的讲座中,我们 git 将我们的教师存储库克隆到其中一个学校服务器中。 然后我们对文件进行更改,提交它们并从 PuTTy 推送它们。

对于我们的家庭作业,我们 fork 教师存储库,git 将它们克隆到服务器中,同样的事情再次发生。

这让我想到了我的具体问题:也就是说,因为它已经被克隆了,所以我认为没有必要再次复制文件,所以我继续我的更改,git 添加 ., git commit -m "comment" 但是当将更改推送到 Github 时,它会弹出一个错误。这真的很奇怪,因为我已经将我的提交推送到我的分叉存储库中,但这次由于某种原因它似乎不起作用。

错误信息:

To https://my_account@github.com/my_account/homework.git
 ! [rejected]        master -> master (non-fast-forward)

error: failed to push some refs to 'https://my_account@github.com/my_account/homework.git'

To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  

See the 'Note about
fast-forwards' section of 'git push --help' for details.

在 git 方面我完全是初学者,所以如果这是一个愚蠢或不清楚的问题,我提前道歉。

你应该这样做:

git pull origin your_branch

或(以上命令等于以下两个步骤):

git fetch origin your_branch
git merge your_branch