0
1

More than 1 year has passed since last update.

bash(WSL2)で作業中のgitブランチ名をプロンプトに表示させる

Last updated at Posted at 2022-10-06

ブランチ名をプロンプトに表示させる

以下のサイトを参考にした。
Ubuntu(Linux)のプロンプトにGitのブランチ名を表示する方法

~/.bashrc の末尾に以下を追記

.bashrc
PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w \[\033[01;31m\]$(__git_ps1 "(%s)") \n\[\033[01;34m\]\$\[\033[00m\] '

以下を叩く

$ source ~/.bashrc

before
image.png
after
image.png

何もわかってないけどとりあえずブランチ名が出るようになった。

後で読む

git :: bash プロンプトにブランチ名と作業ツリーの状態を表示する

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1