0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

gitの分岐したブランチの解決の仕方で起こるエラーについて

Posted at

warning: Pulling without specifying how to reconcile divergent branches is discouraged.ということで、git pullしようとすると下記エラーで起こられます。

Error: Unable to Checkout Branch & Pull Changes

分岐したブランチを調整する方法を指定する必要がありますとヒントをくれるので、それに従ってコマンドを打ち込めば解決します。

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
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.
  • デフォルトのpullの挙動を維持し、実行時に--rebaseを明示。
git config pull.rebase false
  • 実行時--rebaseの明示なしで pull --rebase
git config pull.rebase true
  • 差分があればfast forwardする。
git config pull.ff only

※補足

  • git rebase とは、merge と同じく今いるブランチに別のブランチの内容を取り込むコマンド

  • マージコミットが作られないず履歴が綺麗になるオプション --rebase

  • 分岐後に、元ブランチに変更がないときに行われるマージが fast forward(早送り)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?