1

我只是试图用这个命令提交一些东西:

git commit file_name
push origin reponame develop

我得到了错误:

error: failed to push some refs to 'https://my_repo_path'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

所以我试着做

git pull origin repo_name

它给了我一个错误:

* branch            develop    -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
    ... 3 file_names
Please, commit your changes or stash them before you can merge.

解决这个问题的常用方法是什么?

谢谢!

4

2 回答 2

4

听起来您有已修改但未提交的文件。尝试先存储您的更改,然后将它们重新应用到头顶:

git stash
git pull origin repo_name
git stash pop
于 2013-01-29T18:04:07.983 回答
2

在尝试拉动之前,您需要清理工作区。做一个git status,你会看到你有本地的、未签入的更改。您需要先提交或存储这些内容(如消息所述),然后才能从遥控器进行更新。

于 2013-01-29T18:04:29.953 回答