玩转git与github--前期准备
2018-09-14 本文已影响0人
伍陆柒_
概念:
git是一个版本控制工具
github是一个网站,社交平台,开源项目,远程仓库
Git工作流程

使用Git
下载安装git工具
git2.16.1-32位-Windows下载
git2.16.1-64位-Windows下载
安装完毕后,右键菜单中会多出两个git选项

访问https://github.com/注册一个账号并登录
新建一个远程仓库


在本地克隆github远程库
git clone

在任意路径下右键,开启git命令行窗口

之后我们会发现E:/gitTest会有我们的远程库,里面有一个隐藏文件夹.git
设置贡献者(方便与其他程序员沟通)
git config --global user.name [xxx]
git config --global user.email [xxx]
git config --list 查看所有配置
设置贡献者时,[xxx]内部分即是用户名及邮箱,方便其他看到项目的人联系作者,所以推荐与登录邮箱一致,若不写[xxx]则是查看当前用户名及邮箱


分支

什么是分支?
比如我们在github上有一个项目,在后续开发过程中直接在其之上进行修改,一旦出现问题将比较麻烦,所以git的思路是新开一个分支,与主分支一样,这样就可以在分支上进行开发,不需要修改主分支上的内容,后续在合并到主分支当中,相当于发布了一个新的版本

默认只有一个主分支名为master
git的三个区
工作区
工作区则是本地写代码的文件夹,即.git所在的文件夹
暂存区
文件暂存的位置,作为过渡层,工作区不能直接提交到版本区,避免误操作,方便分支操作
版本库