您的位置:首页 > 其它

Git学习笔记

2016-04-05 20:17 465 查看
小白一枚。学习笔记。仅供参考。欢迎指错。

一、快速开发

git –version #查看git版本信息

mkdir tom #创建目录

cd tom #进入目录

git init #创建版本库

ls -a #查看所有文件



echo “zxq” >> zxq #创建文件zxq

git add zxq # 将zxq加入版本控制器

git status # 查看信息



git commit -m “first commit” #提交更改

export GIT_EDITOR=vim #设置默认编辑器

git status # 查看信息



配置作者的信息

git config user.name “zxq”

git config user.email “zxq@sina.com”

查看提交日记

git log



git show ad8031e #查看对象ID对应的信息



git show-branch –more=10



git diff 对象ID1 对象ID2 #查看区别

vim zxq #修改内容

git add zxq

git commit -m “add akuma”

git log

git diff 089238 ad8031e



git rm zxq

git status



git commit -m “rm zxq”

================我是拦路虎==========================

git mv zxq akuma #改名

git commit -m “change to akuma”



mv akuma zxq

git rm akuma

git add zxq



git commit -m “change to zxq” #提交内容

cd ..

git clone tom jerry #克隆版本库

ls -als tom jerry #查看区别

diff -r tom jerry #查看区别



配置文件

.git/config

~/.gitconfig #只有使用 - -global 选项后才会出现

git config user.name “zxq”

git config -l #显示所有的配置信息

git config –unset user.name #取消配置信息
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: