简体   繁体   中英

How do I open git-bash.exe from command prompt such that it executes "git status" automatically and waits for the next command instead of exiting

How can I create a git-bash shortcut which opens git-bash.exe and automatically runs "git status" and/or "git worktree list" at startup and then waits for my next command(s). I have tried:

  • ".\git-bash.exe" -c "git status" but the git-bash window closes immediately after executing git status

  • ".\git-bash.exe" -c "git status;read" , but this way it runs git status, waits for the enter key and closes the git-bash window

You can append the command 'exec $SHELL' to spawn a new interactive shell after your git commands exit. For example:

".\git-bash.exe" -c 'git status;exec $SHELL'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM