1. mac系统zsh终端配置git tab提示以及代码仓库分支显示
2. 安装mysqlclient或者MySQL-python的问题
1. mac系统zsh终端配置git tab提示以及代码仓库分支显示
- git tab提示,在 ~/.zshrc 配置文件添加:
autoload -Uz compinit && compinit效果展示:

- git代码仓库分支显示,~/.zshrc 配置文件添加:
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
RPROMPT=\$vcs_info_msg_0_
# PROMPT=\$vcs_info_msg_0_'%# '
zstyle ':vcs_info:git:*' formats '%b'在右侧显示仓库分支效果展示:

2. 安装mysqlclient或者MySQL-python的问题
报错信息:mysql_config not found
处理方案:查找mysql_config文件夹位置,一般在/usr/local/mysql/bin/这个路径下,将mysql_config链接到/usr/local/bin目录下后, 再进行pip安装
ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config3. git常用命令
查看config:git config --list
配置(全局)用户名:git config (--global) user.name [username]
配置(全局)邮箱:git config (--global) user.email [email]
清除原账号密码:git config --system --unset credential.helper
配置账号密码之后不用每次都输入:git config (--global) credential.helper store;git pull /git push
清理远程分支已删除但是本地还存在的分支:git remote prune origin
修改分支名:git branch -m oldName newName;git push --delete origin oldName;git push origin newName;git branch --set-upstream-to origin/newName 拉取
拉取远程某个分支全部覆盖本地:git fetch --all;git reset --hard origin/分支名称(比如:git reset --hard origin/master)
代码保留回退版本:git reset --soft HEAD^,回退后强制提交:git push origin lyf -f
搞错分支回退到pull或者merge前状态:git reset --hard HEAD^
回滚代码:git reset --hard xxx
拉取远程分支:git pull --rebase origin master
已经add后会退文件:git reset test.py
未add时会退文件:git checkout -- test.py
强制提交:git push origin lyf -f
拉取别的分支的指定提交:git cherry-pick xxx
4. 虚拟环境
安装virtualenvwrapper:
sudo pip install virtualenvwrapper配置virtualenvwrapper, 在 ~/.zshrc 配置文件添加:
export WORKON_HOME='~/.virtualenvs'
source /usr/local/bin/virtualenvwrapper.sh相关命令:
创建虚拟环境
mkvirtualenv -p python2 venvPy2
mkvirtualenv -p python3 venvPy3
查看虚拟环境
lsvirtualenv -b
切换虚拟环境
workon venvPy2
推出虚拟环境
deactivate
删除虚拟环境
rmvirtualenv venvPy2附加. win系统配置PowerShell命令的git提示
# 1.设置权限
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm
# 2.使用PowerShellGet安装
PowerShellGet\Install-Module posh-git -Scope CurrentUser
# 3.全局导入posh-git
Add-PoshGitToProfile -AllHosts取消代理/设置代理
git config --global --unset http.proxy
git config --global --unset https.proxy
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080