Last active
October 27, 2015 15:09
-
-
Save hamuhamu/973f72103313b976c4da to your computer and use it in GitHub Desktop.
Gitのカレントブランチをリネームするサブコマンド
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 | |
CURRENT_BRANCH_NAME=`git rev-parse --abbrev-ref HEAD` | |
NEW_BRANCH_NAME=$1 | |
# 引数が空であればUsageを表示 | |
if [ -z "$NEW_BRANCH_NAME" ]; then | |
echo 'You can rename a branch of git' | |
echo # 改行 | |
echo 'Usage: git rename <CURRENT_BRANCH_NAME> <NEW_BRANCH_NAME>' | |
exit 1 | |
fi | |
git branch -m $CURRENT_BRANCH_NAME $NEW_BRANCH_NAME | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment