配置一个高效快速的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目录,是因为 ...
随机推荐
- 洛谷 P3182 [HAOI2016]放棋子(错排问题)
题面 luogu 题解 裸的错排问题 错排问题 百度百科:\(n\)个有序的元素应有\(n!\)个不同的排列,如若一个排列使得所有的元素不在原来的位置上,则称这个排列为错排:有的叫重排.如,1 2的错 ...
- WIN7中 HttpListener 拒绝访问 异常解决 C#
WIN7中 HttpListener 拒绝访问 异常解决 C# http://www.cnblogs.com/cmdszh/archive/2012/08/16/httplistener.html ...
- 113th LeetCode Weekly Contest Reveal Cards In Increasing Order
In a deck of cards, every card has a unique integer. You can order the deck in any order you want. ...
- hadoop 配置安装
1. 下载hadoop 压缩包, 拷贝到 /usr/hadoop目录下 tar -zxvf hadoop-2.7.1.tar.gz, 比如: 127.0.0.1 localhost 19 ...
- php session_id() session_name()
1.Session.use_cookies:默认值为"1",代表SessionID使用Cookie来传递,反之就是用Query_String来传递 2.Session.name:这 ...
- 子查询及pymysql
子查询 子查询指的是当一个查询语句被作为另一个查询语句的条件时,该查询语句就称之为子查询(内层查询) 可以将一个大问题 拆分几个小的问题 然后一步一步来查询 需求:财务不有哪些人 ),sex ),jo ...
- JAVA实体类不要使用基本类型,基本类型包含byte、int、short、long、float、double、char、boolean
由于JAVA的基本类型会有默认值,例如当某个类中存在private int age;字段时,创建这个类时,age会有默认值0.当使用age属性时,它总会有值.因此在某些情况下,便无法实现age为nu ...
- 安装Drupal
我在虚拟机里面安装了Ubuntu Server 14.参考https://www.digitalocean.com/community/tutorials/how-to-install-drupal- ...
- Zookeeper概念学习系列之zookeeper是什么?
1. Zookeeper是Hadoop的分布式协调服务. 2. 分布式应用程序可以基于它,来实现同步服务,配置维护和命名服务等. 3. zookeeper可以保证数据在zookeeper集群之间的数据 ...
- 0.数据结构(python语言) 基本概念 算法的代价及度量!!!
先看思维导图: *思维导图有点简陋,本着循循渐进的思想,这小节的知识大多只做了解即可. *重点在于算法的代价及度量!!!查找资料务必弄清楚. 零.四个基本概念 问题:一个具体的需求 问题实例:针对问题 ...