git是啥??:
Git是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。
Git 是 Linus Torvalds(这位是linux的作者) 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件。
Git 与常用的版本控制工具 CVS, Subversion 等不同,它采用了分布式版本库的方式,不必服务器端软件支持。
基本操作:
1.git init
初始化git(注意:需在项目目录下初始化)
example:
cd ~/Desktop 进入桌面目录
mkdir git-demo 创建项目目录
git init 在项目目录中创建一个.git目录,它是一个仓库;我们再git-demo中创建任意工程文件,例如:
index.html css/style.css(这里注意一下,需要先mkdir css创建css文件夹;直接css/style.css是不会创建新文件夹的)
2.git add
将创建的文件加入到暂存区
example:
git add index.html (我们仅上传一个文件
git add . (我们上传整个当前目录
3.git commit -v
将暂存区的文件正式提交到本地仓库,这个本地仓库就是.git
常用提交命令: git commit -m “commit message” 和 git commit -v的差别:
前者 -m
后者 git commit -v Show unified diff between the HEAD commit and what would be committed at the bottom of the commit message template to help the user describe the commit by reminding what changes the commit has. -v命令用于显示提交更改。