forkしたrepositoryのremoteを最新化しつつローカルにpullするスクリプトを書いた

目次
前提#
gh
コマンドがインストールされていること- デフォルトブランチにいること
tl;dr#
# forkしたrepositoryのremoteを更新しつつpullする
function git-sync() {
REPO=$(git remote get-url origin | sed -E 's%.+github.com/(.*).git$%\1%')
echo "🔄 Syncing ${REPO}...\\n"
gh repo sync ${REPO} && git pull
}
alias gsy=git-sync
嬉しさ#
もともとは以下の2ステップだったが前述のスクリプトを使うと1ステップにまとめることができる。
- ブラウザで
Sync fork > Update branch
をクリック - ローカルで
git pull
を実行
Read other posts