Git笔记

栏目: 编程工具 · 发布时间: 5年前

内容简介:1.6.5以上可以使用下面的方式,自动创建目录

全局用户

git config --global user.name "my name"
git config --global user.email "email@oss.com"
# 删除
git config --global --unset "my name"
git config --global --unset "email@oss.com"
# 查看
git config user.name
git config user.email

设置别名

# 加上sudo给所有用户
sudo git config --system alias.st status # git st 代替 git status
sudo git config --system alias.ci commit # git ci 代替git commit
sudo git config --system alias.co checkout # git co 代替git commit
sudo git config --system alias.br branch # git br 代替 branch

给输出设置颜色

git config --global color.ui true

初始化仓库

mkdir demo
cd demo
git init

1.6.5以上可以使用下面的方式,自动创建目录

git init demo

添加到暂存区

git add 1.txt

提交

git commit -m "some message"

显示.git所在目录

git rev-parse --git-dir

显示工作区根目录

git rev-parse --git-dir

显示当前目录相对于工作区目录

git rev-parse --show-prefix

显示当前目录后退到工作区根目录的深度

git rev-parse --show-cdup

显示提交状态

git log --stat
#或
git log --pretty=online
# 或
git status -s

查看版本差异

git diff

以上所述就是小编给大家介绍的《Git笔记》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Looking For a Challenge

Looking For a Challenge

the University of Warsaw / the University of Warsaw / 2012-11 / 0

LOOKING FOR PROGRAMMING CHALLENGES? Then this book is for you! Whether it's the feeling of great satisfaction from solving a complex problem set, or the frustration of being unable to solve a task,......一起来看看 《Looking For a Challenge》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

URL 编码/解码
URL 编码/解码

URL 编码/解码