Skip to content

Instantly share code, notes, and snippets.

@maruel
Created June 20, 2022 18:38
Show Gist options
  • Save maruel/f44bd4b3fab22f1bcaa69a7057f23817 to your computer and use it in GitHub Desktop.
Save maruel/f44bd4b3fab22f1bcaa69a7057f23817 to your computer and use it in GitHub Desktop.
Filter periph.io old repository into new repositories.
#!/bin/bash
# This script requires https://github.com/newren/git-filter-repo/ to be in PATH.
PATH=$HOME/src-oth/git-filter-repo:$PATH
set -eux
function makepkg {
PKG=$1
shift
git init $PKG
cd $PKG
git remote add origin https://github.com/google/periph
git fetch origin
git filter-repo \
--path AUTHORS \
--path CONTRIBUTING.md \
--path CONTRIBUTORS \
--path LICENSE \
--path README.md \
--path $PKG --path experimental/$PKG $@
git remote add origin [email protected]:periph/$PKG
git fetch origin
# Use the occasion to rename from master to main since we are starting from
# scratch.
git branch -m main
git push origin main
cd -
}
makepkg cmd
makepkg conn
makepkg devices
makepkg host --path-regex "^[a-z_]+\.go$"
git mv $PKG/* .
git rm experimental/$PKG/README.md
git mv experimental/$PKG/* .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment