简体   繁体   English

如何从命令提示符打开 git-bash.exe 以便它自动执行“git status”并等待下一个命令而不是退出

[英]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).我如何创建一个 git-bash 快捷方式来打开 git-bash.exe 并在启动时自动运行“git status”和/或“git worktree list”,然后等待我的下一个命令。 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"但 git-bash window 在执行 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 ".\git-bash.exe" -c "git status;read" ,但这样它运行 git 状态,等待回车键并关闭 git-bash window

You can append the command 'exec $SHELL' to spawn a new interactive shell after your git commands exit.在 git 命令退出后,您可以 append 命令“exec $SHELL”生成一个新的交互式 shell。 For example:例如:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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