原文:shell提示符显示git当前分支

编辑 etc profile或者 .bashrc 在行末添加如下内容 获取git当前分支 git branch branch cd PWD if d .git then output git describe contains all HEAD tr s n if output then branch output fi fi echo branch linux IPADDRS sbin ifco ...

2014-03-03 20:54 0 2369 推荐指数:

查看详情

Shell 提示符显示 Git 分支名称

| 导语 如果你是用命令行来使用Git的话,当在一个项目中频繁使用多个分支时,可以使用 git status 命令查询自己现在正工作在哪个分支下面,不过难免有脑子发昏的时候,忘记自己在哪个分支下面,因而发生误操作之类的杯具。 那么把分支显示Shell 提示符中无疑方便了很多,再也不需要频繁 ...

Wed Sep 07 17:35:00 CST 2016 0 1896
linux shell 提示符

当我们打开或者登陆到一个终端的时候都会显示一长串提示符 提示符一般包含当前登陆的用户名 ,主机名,以及当前工作路径路径,最后都是以 $ 或者 # 号结束,普通用户以 $ 号结束,只有root用户以 #结束。 因为包含了当前工作路径,所以当我们切换工作路径的时候,提示符也是会变化 ...

Sun Jun 02 18:59:00 CST 2019 0 834
linux下shell显示git当前分支

function git-branch-name { git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3 } function git-branch-prompt { local branch=`git ...

Wed Nov 08 18:08:00 CST 2017 0 1604
Shell:命令提示符

Blog:博客园 个人 参考:命令提示符 目录 概述 环境变量 PS1 颜色 环境变量 PS2,PS3,PS4 概述 用户进入 Bash 以后,Bash 会显示一个命令提示符,用来提示用户在该位置后面输入命令。 环境变量 PS1 ...

Tue Dec 15 16:44:00 CST 2020 0 390
Linux修改Shell命令提示符及颜色

Linux修改Shell命令提示符及颜色 1. Linux登录过程中加载配置文件顺序: /etc/profile → /etc/profile.d/*.sh → ~/.bash_profile → ~/.bashrc → [/etc/bashrc] 可查看默认 ...

Tue Nov 22 23:08:00 CST 2016 0 4345
Linux修改Shell命令提示符及颜色

1. Linux登录过程中加载配置文件顺序: /etc/profile → /etc/profile.d/*.sh → ~/.bash_profile → ~/.bashrc → [/etc/bashrc]可查看默认的~/.bashrc文件如下: 2. Shell命令提示符及颜色 ...

Mon Oct 02 00:18:00 CST 2017 0 8992
修改shell命令提示符和命令的输入颜色

修改命令提示符颜色 修改命令提示符的话,只需修改PS1环境变量即可。 效果如图: 修改命令输入的颜色 修改命令输入的颜色,思路是不关闭PS1的颜色,然后在每次敲下回车键执行命令的时候自动插入颜色终止。这需要借助trap捕获DEBUG信号来实现。 如果要写入shell ...

Sat Sep 21 20:45:00 CST 2019 0 388
Linux修改Shell命令提示符及颜色

//转自http://www.linuxidc.com/Linux/2014-10/108195.htm Linux修改Shell命令提示符及颜色 1. Linux登录过程中加载配置文件顺序: /etc/profile → /etc/profile.d/*.sh ...

Sat Feb 18 19:14:00 CST 2017 0 1398
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM