git config文件总结及git alias配置

1. 文件位置

mac

/etc/.gitconfig 系统级
~/.gitconifg 用户级(覆盖系统级)

windows

C:\Users\$user\.gitconfig

当前项目下

.git/.gitconfig(覆盖用户级)

2.配置用户名和邮箱

全局

$ git config --global user.name  ygtzz
$ git config --global user.email ygtzz@126.com

局部(当前项目)

$ git config user.name  ygtzz
$ git config user.email ygtzz@126.com

3.快速打开gitconfig

git config [--global] --edit

4.修改编辑器

$ git config --global core.editor emacs

5.查看gitconfig内容

$ git config --list

git alias配置

复制代码
[alias]
st = status -sb
co = checkout
br = branch
mg = merge
cm = commit
ds = diff --staged
dt = difftool
mt = mergetool
last = log -1 HEAD
latest = for-each-ref --sort=-committerdate --format=\"%(committername)@%(refname:short) [%(committerdate:short)] %(contents)\"
ls = log --pretty=format:\"%C(yellow)%h %C(blue)%ad %C(red)%d %C(reset)%s %C(green)[%cn]\" --decorate --date=short
hist = log --pretty=format:\"%C(yellow)%h %C(red)%d %C(reset)%s %C(green)[%an] %C(blue)%ad\" --topo-order --graph --date=short
type = cat-file -t
dump = cat-file -p
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
[core]
autocrlf = true
[push]
default = simple
复制代码

 

参考:http://blog.csdn.net/joe_007/article/details/7276195
   http://blog.csdn.net/shrimpcolo/article/details/49302619

posted @   全玉  阅读(6463)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示