Skip to content

Instantly share code, notes, and snippets.

@pyohei
Forked from mattn/gitcd.bat
Created March 26, 2017 11:33
Show Gist options
  • Save pyohei/d85d9b17dcba2fe7c23b399322e4460d to your computer and use it in GitHub Desktop.
Save pyohei/d85d9b17dcba2fe7c23b399322e4460d to your computer and use it in GitHub Desktop.
@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