test.sh

· rfc1149's pastes · raw

expires: 2026-01-26

 1#! /bin/sh
 2
 3rm -rf testrepo
 4git init -b master testrepo
 5cd testrepo
 6
 7# Create the first part of the master branch
 8echo "This is the old master" > README
 9git add README
10git commit -m "Old master"
11
12# Add a PR on top of this beginning of the master branch
13git checkout -b pr 
14echo "This is the PR" > README
15git commit -am "PR"
16
17# Add a commit to make the master branch advance since the PR
18git checkout master
19echo "Master has advanced" > README
20git commit -am "Old master again"
21
22# Create the new main branch from the current state of master
23# but with no common history (history rewrite).
24git checkout --orphan main master
25echo "This is the new main branch" > README
26git commit -am "Main"
27
28# Rebase the pr branch from master to main
29git rebase -X theirs --onto main master pr