force merge unrelated histories code example

Example 1: fatal: refusing to merge unrelated histories

git pull origin master --allow-unrelated-histories

Example 2: fatal: refusing to merge unrelated histories

git pull origin master --allow-unrelated-histories

Example 3: refusing to merge unrelated histories

git pull origin main --allow-unrelated-histories

Example 4: fatal: refusing to merge unrelated histories

git pull origin master --allow-unrelated-histories
git pull <remote> <branch> --allow-unrelated-histories

Example 5: fatal: refusing to merge unrelated histories

git pull origin branchname --allow-unrelated-histories

Example 6: git refusing to merge unrelated histories on rebase

git merge upstream/master --allow-unrelated-histories

Tags:

Ruby Example