git pushしたときにYour branch is ahead

% git push
To https://github.com/you_name/pb_bk.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘https://github.com/you_name/pb_bk.git’
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., ‘git pull …’) before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push –help’ for details.

リモートにローカルにない作業が含まれているため、更新は拒否されました。
これは通常、別のリポジトリが同じ参照にプッシュすることによって発生します。
もう一度プッシュする前に、最初にリモートの変更(たとえば、「git pull …」)を統合することをお勧めします。
詳細については、「git push–help」の「早送りに関する注意」を参照してください。

とのこと。。。
もひとつわからんなぁ。。ってことで。。

% git status
On branch master
Your branch is ahead of ‘origin/master’ by 1 commit.
(use “git push” to publish your local commits)

nothing to commit, working tree clean

ブランチマスターについて
あなたのブランチは「origin/master」より1コミット進んでいます。
(「git push」を使用してローカルコミットを公開します)

% git pull origin
remote: Enumerating objects: 25, done.
remote: Counting objects: 100% (25/25), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 13 (delta 9), reused 13 (delta 9), pack-reused 0
Unpacking objects: 100% (13/13), 1.23 KiB | 157.00 KiB/s, done.
From https://github.com/kumakake/pb_book
245d726..a4a6073 master -> origin/master
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace “git config” with “git config –global” to set a default
hint: preference for all repositories. You can also pass –rebase, –no-rebase,
hint: or –ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.

■対応したこと

$ git config pull.rebase false 
$ git pull origin
Auto-merging sapp/routes/deli/home.js
Merge made by the ‘ort’ strategy.

この後普通に使えた。。
これは何だったんだろう。。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です