LoginSignup
3
1

More than 5 years have passed since last update.

git shellにhistory機能を追加する

Last updated at Posted at 2017-10-24

git shellにhistory機能を追加する(Windows)

Github for windowsをインストールするとついてくるgit shell、パワーシェルを使用しているはずが再起動するとコマンド履歴がリセットされてしまう。

環境

  • windows 10
  • git shell

原因

windows 10ではdefaultでインストールされているはずのPSReadLineが読み込まれていない。これはシンタックスハイライトやキーバインドを管理したりするコンソール拡張のモジュールらしい。もちろんコマンド履歴保存機能もある。

PSReadLineをインストールする

PowerShellGet がインストールされていない場合は先にインストールしておく。

Install-Module PSReadline
Import-Module PSReadLine

終わり。

おまけ

power shellでは.bash_profileはないが似たようなものはある。

C:\Users\xxx\AppData\Local\GitHub\PoshGit_xxxxxxxxxxxxxxxxxxxxxxx\profile.example.ps1:

がgit shell独自で読み込まれるもので、追記するとシェル起動時に実行される。

3
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
3
1