Add a script for backporting commits

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
This commit is contained in:
Changyuan Lyu 2023-05-26 15:50:50 -07:00
parent a9e7c8e045
commit 33c68c809c

20
backport.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
set -e
mkdir -p p9cpu
for file in $(ls -A); do
if [ $file != "p9cpu" ] && [ $file != ".git" ] && [ $file != "backport.sh" ]; then
mv $file p9cpu/
fi
done
git add p9cpu
git commit -m "tmp commit 1"
git am $1
HASH=$(git rev-parse HEAD)
for file in $(ls -A p9cpu); do
mv p9cpu/$file .
done
rm -r p9cpu
git reset --soft HEAD~2
git add .
git commit -m "$(git log -1 --format=%B $HASH)"