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

プルを試す前に、ワークスペースをクリーンアップする必要があります。aを実行するgit statusと、チェックインされていないローカルの変更があることがわかります。リモートから更新する前に、(メッセージにあるように) それらをコミットまたは隠しておく必要があります。

于 2013-01-29T18:04:29.953 に答える