Git入门第十七讲:Git常用配置
发布日期:2021-05-08 03:50:40 浏览次数:24 分类:精选文章

本文共 1030 字,大约阅读时间需要 3 分钟。

Git入门第十七讲:Git常用配置

1. 显示不同的颜色

# 显示不同的颜色git config --global color.ui true

2.忽略特殊文件

.gitignore文件就是配置忽略特殊文件的

常用各种忽略文件配置:

在这里插入图片描述

#  Maventarget/pom.xml.tagpom.xml.releaseBackuppom.xml.versionsBackuppom.xml.nextrelease.propertiesdependency-reduced-pom.xmlbuildNumber.properties.mvn/timing.properties# https://github.com/takari/maven-wrapper#usage-without-binary-jar.mvn/wrapper/maven-wrapper.jar
# Windows:Thumbs.dbehthumbs.dbDesktop.ini# Python:*.py[cod]*.so*.egg*.egg-infodistbuild# My configurations:db.inideploy_key_rsa

3.给命令设置别名

# 讲git status 改成git stgit config --global alias.st statusgit config --global alias.co   checkoutgit config --global alias.ci   commitgit config --global alias.br   branchgit config --global alias.unstage 'reset HEAD'git config --global alias.last    'log -1'git config --global alias.lg      "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

配置Git的时候,加上--global是针对当前用户起作用的,如果不加,那只针对当前的仓库起作用。

或者直接在.git/config文件下写配置也行
在这里插入图片描述

参考廖雪峰官网:

上一篇:DHCP
下一篇:VRRP

发表评论

最新留言

哈哈,博客排版真的漂亮呢~
[***.90.31.176]2025年04月09日 14时48分54秒