Last active
February 4, 2021 15:14
-
-
Save yanniszark/4165bd8f92d9838e143495e5a8df2ce0 to your computer and use it in GitHub Desktop.
Trigger git rebase directory detection breakdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create demo repo | |
rm -rf /tmp/demo | |
mkdir /tmp/demo && cd /tmp/demo | |
git init | |
# Create upstream branch | |
git checkout -b upstream | |
for p in a b c d e f g h i j k l m n o p q r s t u v w x y z a1 a2 a3 a5 | |
do | |
mkdir -p $p/base && echo "base" > $p/base/base.txt | |
git add -A && git commit -m "Upstream base for $p" | |
done | |
for p in a b c d e f g h i j k l m n o p q r s t u v w x y z a1 a2 a3 a5 | |
do | |
mkdir -p $p/overlays/upstream | |
echo "upstream_overlay" > $p/overlays/upstream/overlay.txt | |
git add -A && git commit -m "Upstream overlay for $p" | |
echo "file $p lalakis" > $p/overlays/upstream/file_1.txt | |
echo "file" > $p/overlays/upstream/file_$p.txt | |
echo "file" > $p/overlays/upstream/file_3.txt | |
echo "file $p" > $p/overlays/upstream/file_$p.txt | |
echo "file" > $p/overlays/upstream/file_5.txt | |
git add -A && git commit -m "Upstream files for $p" | |
done | |
# Create restructured upstream branch | |
git checkout -b upstream-restructured upstream | |
mkdir -p new | |
for p in a b c d e f g h i j k l m n o p q r s t u v w x y z a1 a2 a3 a5 | |
do | |
git mv $p new/$p | |
git add -A && git commit -m "Move $p to new/$p" | |
done | |
# Create downstream branch | |
git checkout -b downstream upstream | |
for p in a b c d e f g h i j k l m n o p q r s t u v w x y z a1 a2 a3 a5 | |
do | |
mkdir -p $p/overlays/develop && echo "overlay for $p" > $p/overlays/develop/overlay.txt | |
git add -A && git commit -m "Add overlay for $p" | |
done | |
# Rebase downstream ontop of upstream-restructured | |
git checkout downstream | |
git -c merge.directoryRenames=true rebase -v -m --onto upstream-restructured upstream |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment