Git常用命令

[TOC]

1. 配置使用默认密码

cd ~



echo "https://eager7:pct1197639@github.com" > .git-credentials



git config --global credential.helper store
可以看到~/.gitconfig文件,会多了一项:



[credential]



    helper = store

2. 使用vim作为默认的编辑器

3. 基本使用命令

3.1 查看本地版本的状态以及差异:

3.2 增加到本地库:

3.3 提交到本地:

这样提交会弹出一个vim的文本编辑界面,写入你的注释,第一行简略描述,空一行,然后详细描述。

3.4 提交到远程仓库,即网络上:

3.5 下载一个分支

3.6 建立一个分支

3.7 create a new repository on the command line

4. 设置git配置

设置git全局设置:

需要取消git的全局设置:

针对每个项目,单独设置用户名和邮箱,设置方法如下:

最后更新于

这有帮助吗?