扫码关注官方订阅号
当我git status时,会出现如图:
然后我想要从中截取出我的分支名就是 “feature/gengxiankun20160504”这个字符串,我用grep,后把结果赋给变量
请问怎么操作这个字符串变量能截取到我的分支名?我的分支名不固定
欢迎选择我的课程,让我们一起见证您的进步~~
git branch -v|grep \*|awk '{print $2}'
git status | grep 'On branch' | cut -d' ' -f4
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
git status | grep 'On branch' | cut -d' ' -f4