windows下gitHub笔记!
2017-07-02 本文已影响13人
DragonersLi
https://github.com/ 注册账号登陆!
https://desktop.github.com/ 软件下载地址!
https://www.git-scm.com/download/win Windows下载Git地址!
GitHub:

安装完成后,桌面鼠标右击,菜单会出现如下图:

新建项目文件夹进入后鼠标右击,选 Git Bash Here !进入命令行,输入如下两行命令配置用户名和邮箱。

//获取配置列表
git config --list
//配置用户名
git config --global user.name 'DiorsCoder'
//配置邮箱
git config --global user.email '865196792@qq.com'
//创建项目目录并进入
mkdir dirName
cd dirName
//git控制
git init


使用Git添加文件到暂存区,可以使用linux命令也可以windows界面操作!
//创建,编辑,查看文件内容
touch fileName
vim fileName
cat fileName
//查看状态
git status
//添加 & 修改:先添加或修改本地文件,再提交到 Git 暂存区 ,最后提交!
git add fileName
git commit -m ‘备注’
git push
//删除文件步骤:
rm fileName
git rm fileName
git commit -m ‘备注’
git push
//删除文件夹步骤:
rm -rf dirName
git rm -rf dirName
git commit(文件写入备注)
git push
一.添加文件到暂存区:

二.提交文件到版本库

从 GitHub 上 复制仓库地址,在本地 使用命令:git clone https://github.com/GitHub账户/项目名.git ,把项目克隆至本地。


//查看所有分支
git branch -a
//切换分支
git checkout 分支名称
//合并其它分支代码
git merge 其它分支名称
//查看日志
git log
//更新仓库最新代码至本地
git pull
登录GitHub新建仓库:账户名.github.io,新建html文件:index.html。例如:DiorsCoder.github.io

然后浏览器输入访问:https://账户名.github.io
例如:https://diorscoder.github.io