cygwin配置git

对于windows用户来说,使用git bash经常会出现乱码情况,那么一款优质高尚的软件,值得推荐一下了,那就是cygwin

下载cygwin后,在安装过程中,安装git,安装vim编辑器

然后会在安装目录下看到类linux目录结构:

配置别名alias:

打开vim /etc/bash.bashrc,添加:

#自定义ls颜色

alias grep='grep --color' # show differences in colour
alias ls='ls -hF --color=tty --show-control-chars' # classify files in colour
alias dir='ls --color=auto --format=vertical --show-control-chars'
alias vdir='ls --color=auto --format=long --show-control-chars'
alias ll='ls -la --show-control-chars' # long list
alias la='ls -A --show-control-chars' # all but . and ..
alias l='ls -lF --show-control-chars'
## 添加清屏处理
alias clear='clearn'

配置git设置:

打开 vim ~/.gitconfig,添加:

[user]
name = #your name#
emali = #your email# 

[color]
ui = true

[alias]

co = checkout
br = branch

lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

 

配置上传时忽略文件类型:

vim ~/.gitignore,添加

/bin/
/work/
/.gitignore
.idea
oskey
oskey.pub
*/*.iml
target
target/*
afbx.iml
.git-credentials
*/.classpath
*/.settings/*
*/.project

好了,保存,关闭cygwin后重新打开,切换到git项目目录

发现ls后可以显示各种颜色,再看git lg

git lg -p:查看详细修改

the end...

逃避不一定躲得过,面对不一定最难过
原文地址:https://www.cnblogs.com/yangzhenlong/p/5547388.html