Created
February 28, 2020 14:40
-
-
Save choroba/f2b4dadacc2a86788f97405e43e27ae7 to your computer and use it in GitHub Desktop.
Git rebase with copy
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 | |
set -eu | |
tmp=$(mktemp -d) | |
cd "$tmp" | |
git init | |
git config user.email abc@example.com | |
echo file a > a.txt | |
echo file b > b.txt | |
git add [ab].txt | |
git commit -m 'init' | |
git checkout -b copy | |
cp a.txt A.txt | |
cp b.txt B.txt | |
git add [AB].txt | |
git commit -m 'copy' | |
git checkout master | |
echo fix >> a.txt | |
git add a.txt | |
git commit -m 'fix' | |
git checkout copy | |
git rebase master | |
git log --follow --stat A.txt | grep -C4 fix | |
rm -rf "$tmp" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment