历史上的今天: 2020-06-23 写了个shell脚本(刚装完linux可以执行一下) 2019-06-23 Big Data(四)关于Hadoop的HA&CAP理论详解 2019-06-23 Big Data(三)伪分布式和完全分布式的搭建 MENU Mac重新修改terminal显示git分支(show git branch prompt) 发表于 2021-06-23 16:14阅读次数:252评论次数:0Git Th...
Thegit_branch()is a function, that prints the name of the current Git branch in the round brackets. We set thePS1variable and place the functiongit_branch()inside it to display the Git branch in the terminal prompt. The function inside thePS1variable must be in the following format:\$(g...
AI代码解释 #返回$1指定的git项目的当前分支(branch)或标签名(tag)# $1 git项目源码位置,为空获则默认为当前文件夹functioncurrent_branch(){local folder="$(pwd)"[-n"$1"]&&folder="$1"git-C"$folder"rev-parse--abbrev-refHEAD|grep-vHEAD||\ git-C"$folder"describe--exact-matchHEAD||\ git-...
5. The –show-current Flag Similarly, we can employ the git branch –show-current command in place of __git_ps1. The git branch command along with the –show-current flag can colorize the prompt for the current Git branch in Bash. To do this, let’s reset the PS1 variable by alteri...
git-prompt.sh : This script allows you to see repository status in your prompt. bashrc : The individual per-interactive-shell startup file. 前两个是在安装git的时候带的脚本,实现代码补全和高亮显示,第三个是根据自己需求设置的文件。 怎么运行使用脚本里面都有注释,我在这里简单描述一下 ...
《Show git branch and status in Mac Bash》 这算是git官方提供的解决方案: 首先下载下面这个git官方仓库的脚本到本地,比如命名为~/.git-prompt.sh https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh 基于zsh 然后打开$HOME下的.zshrc,如果~/.zshrc不存在,就先执行下面的命令创建它...
All of the version control systems supported by powerline shell give you a quick look into the state of your repo: The current branch is displayed and changes background color when the branch is dirty. When the local branch differs from the remote, the difference in number of commits is s...
git branch (-d | -D) [-r] <branchname>… git branch --edit-description [<branchname>] 概述 如果给出了--list或者如果没有非选项参数,则列出现有的分支; 当前分支将以星号突出显示。 选项-r导致远程跟踪分支被列出,而选项-a显示本地和远程分支。 如果给出了一个,它将被用作一个shell通配符,...
examples/bash_git_prompt.sh # Bash: when in a git repository, show the current branch, indicate if the working directory is clean or not. function __set_my_prompt { local RED="\033[0;31m" local GREEN="\033[0;32m" local NOCOLOR="\033[0m" ...
set -g __fish_git_prompt_showcolorhints yes set -g __fish_git_prompt_showdirtystate yes set -g __fish_git_prompt_showuntrackedfiles yes set -g __fish_git_prompt_show_informative_status yes set -g __fish_git_prompt_color_branch_dirty red set -g __fish_git_prompt_color_branch_stag...