DEV Community

Dakini
Dakini

Posted on

4 4

ターミナルにカレントリポジトリを表示させる方法

https://qiita.com/varmil/items/9b0aeafa85975474e9b6

Unix環境であればこちらの記事が参考になります。

Windows環境下のGit Bashにも表示させたかったのでwgetの代わりにbitsadminを使用しました。

bitsadmin /TRANSFER 適当なジョブ名 https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh ダウンロードしたい場所のフルパス/.git-prompt.sh

Enter fullscreen mode Exit fullscreen mode

でファイルを落として後はUnix系と同じく.bashrcに

if [ -f $HOME/.git-prompt.sh ]; then
  source $HOME/.git-prompt.sh
fi
GIT_PS1_SHOWDIRTYSTATE=1
export PS1='[\w$(__git_ps1 " (%s)")]\$ '
Enter fullscreen mode Exit fullscreen mode

こんな感じに書いた後

$ source ~/.bashrc

で表示できました。

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay