配置一个高效快速的Git环境
可以直接修改~/.gitconfig文件,也可以用命令配置一个可以实际使用的高效的Git环境。
username and email
这两项是必须的。
git config --global user.name gituser
git config --global user.email email@git.com
or
[user]
name = gituser
email = email@git.com
editor
git config --global core.editor "code -n -w"
or
[core]
editor = /usr/bin/code -n -w
指定外部编辑器用于编辑多行commit,比如vscode。
-n(new)打开新窗口编辑commit-w(wait)使git等待用户退出编辑器后才继续执行,以免执行git commit之后出现Aborting commit due to empty commit message.的错误
difftool and mergetool
using meld, for ubuntu:
sudo apt install meld
git config --global diff.tool meld
git config --global merge.tool meld
git config --global mergetool.keepBackup false
or
[diff]
tool = meld
[merge]
tool = meld
[mergetool]
keepBackup = false
keepBackup = false成功合并后可以自动删除备份文件。
alias
Git命令别名,更高效更快速更专业...a-ha......
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st "status --short"
- 以
co作为checkout的别名,以此类推 st作为status --short的别名,输出信息更精简(虽然不符合linux命令越短事越大的风格)
配置文件如下:
[alias]
br = branch
brd = branch -d
ck = checkout
ckb = checkout -b
ckf = checkout --
cm = commit
cmm = commit -m
df = diff
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
last = log -1 HEAD
mg = merge
ss = stash
st = status --short
stt = status
unstage = reset HEAD --
进一步,在linux的别名文件~/.bash_aliases中定义如下别名,这样可以更快的执行命令:
# git
alias gg='gitg' # gitg
alias gadd='git add'
alias gbr='git br' # branch
alias gbrd='git brd' # branch -d
alias gck='git ck' # checkout
alias gckb='git ckb' # checkout -b
alias gckf='git ckf' # checkout --
alias gcm='git cm' # commit
alias gcmm='git cmm' # commit -m
alias gdf='git df' # diff
alias gdfa='git diffall' # git-diffall
alias gdfah='git diffall HEAD' # git-diffall
alias gdfal='git diffall HEAD HEAD^1'
alias glg='git lg' # colorful oneline git log
alias glast='git last' # log -1
alias gmg='git mg' # merge
alias gss='git ss' # stash
alias gst='git st' # status --short
alias gstt='git stt' # status
配置一个高效快速的Git环境的更多相关文章
- 【Git】2、Linux快速安装Git环境 & oh-my-zsh
Linux快速安装Git环境 文章目录 Linux快速安装Git环境 1.Linux安装Git 2.安装zsh 3.安装oh-my-zsh 3.1.安装oh-my-zsh 3.2. 测试验证 4.小结 ...
- 通过Vim+少量插件配置一个高效简洁的IDE
最近本人在看<TCP/IP Illustrated Volume2:The Implementation>这本书,自然要下载4.4BSD-Lite的源代码配合书本一起研读.以前学习Vim的 ...
- Windows环境下利用github快速配置git环境
在windows环境下利用github客户端我们可以直接拥有可视化的界面来管理工程,当然你也可以选择你喜欢的命令行工具来做.今天我分享一个比较快速的方式来配置git环境. 先去下载github的win ...
- Hexo+Git一个小时快速搭建个人博客
搭建本地环境:Hexo框架 Hexo为何物 Hexo 是一个快速.简洁且高效的博客框架.Hexo 使用Markdown解析文章,并瞬间利用靓丽的主题生成静态网页.其中,Markdown是一个用于将普通 ...
- 快速为git添加一个用户
环境:用gitosis-admin管理git的权限. 前期git环境的搭建略去,主要给出快速添加一个用户的步骤: 在git bash中用“ssh-keygen -t rsa”生成公钥私钥,默认放到 “ ...
- Mac下配置git环境和客户端SourceTree+Git常用命令大全(Mac 10.12)
前言: 如果不想折腾,直接下载GitHub桌面端,高度集成git,不需要学习git的任何命令. https://desktop.github.com/ 一.配置git环境 1.上官网https://g ...
- 有关PHPstorm的git环境的配置和git密钥的生成总结
phpstorm上配置git环境的配置总感觉很简单,没发现看似简单的东西浪费我好多时间.我在网上查了一下关于phpstorm的git环境的配置没有具体的总结 所以我把自己的配过程简单总结了一下 接下来 ...
- 配置GitLab或Git环境之教程
配置GitLab或Git环境之教程 1.安装好Git后,首先打开开始菜单的所有程序里面的git文件夹,打开Git Bash/ 2.弹出的命令行里面输入ssh-keygen 输入y,一直Enter ...
- windows配置jdk环境变量、mysql环境变量、tomcat环境变量、maven环境变量、git环境变量、node环境变量
一.windows配置各种环境变量后 path 路径下的目录: 二.windows 配置各种环境变量的目的: 为windows系统添加上各种环境对应的命令 举例,为什么要添加jdk的bin目录,是因为 ...
随机推荐
- vue 中引用 百度地图
1.在 http://lbsyun.baidu.com/ 申请 秘钥 2.在index.html文件中引入 <script src="http://api.map.baidu.com/ ...
- 自动判断文本文件编码来读取文本文件内容(.net版本和java版本)
.net版本 using System; using System.IO; using System.Text; namespace G2.Common { /// <summary> / ...
- eclipse 安装 scala
1.官网下载地址 http://scala-ide.org/download/current.html 目前最新的版本 http://download.scala-ide.org/sdk/lithiu ...
- OPENROWSET read excel
由于64位系统已经不支持 oledb 4.0访问 xls 1. 未在本地计算机上注册“microsoft.ACE.oledb.12.0”提供程序 去http://download.microsoft. ...
- 15019:Only the instance admin may alter the PermSize attribute
15019:Only the instance admin may alter the PermSize attribute TimesTen提示空间不足,增加空间重启后提示15019:Only th ...
- Nginx设置日志分割方法
目标:nginx cronolog日志分割配置文档,每分钟分割一次NGINX访问日志. 大体步骤如下: 1.nginx日志配置 access_log /var/log/nginx/access.log ...
- 动态替换animator的研究
http://blog.csdn.net/tonnychu/article/details/49903657 http://blog.csdn.net/tlrainty/article/details ...
- 【c#文档】在 C# 中,(int) ,Int32.Parse() 和 Convert.toInt32() 三种方法的区别
[c#文档]https://msdn.microsoft.com/zh-cn/library/system.convert.toint32.aspx 转载自:http://www.cnblogs.co ...
- Jascript面向对象
JavaScript 的核心是支持面向对象的,同时它也提供了强大灵活的 OOP 语言能力.本文从对面向对象编程的介绍开始,带您探索 JavaScript 的对象模型,最后描述 JavaScript 当 ...
- MVC 下拉框获取值和赋值(多选)
1.视图 <div class="form-group"> @Html.LabelFor(m => m.Positions, new { @class = &qu ...