Created
March 23, 2017 07:13
-
-
Save mattn/7001b16e5b28ae25634ca11185c5bb8e to your computer and use it in GitHub Desktop.
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
@echo off | |
chdir %* | |
set BRANCH= | |
for /f "eol=; tokens=1,2 delims== " %%i in ('"git branch 2>NUL"') do if "%%i"=="*" set BRANCH=%%j | |
if "%BRANCH%" neq "" ( | |
set PROMPT=$P^(%BRANCH%^)$G | |
) else ( | |
set PROMPT=$P$G | |
) | |
rem 設定方法 | |
rem | |
rem https://mattn.kaoriya.net/software/why-i-use-cmd-on-windows.htm | |
rem | |
rem ここ見て init.cmd が使える様にして、init.cmd の中に以下を追加 | |
rem doskey cd=gitcd $* | |
rem ※ gitcd.bat は本ファイル |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ちなみに
git checkout feature
でブランチ変えた場合はcd
を単にタイプしないとプロンプトは更新されないよ。