git命令入门
1.创建工作区
选择一个文件夹作为一个工作区(working area)
git init
2.将工作区的文件添加都暂存区
将工作区(working area)中的文件(或内容)添加暂存区(index),为下一次提交(commit)做准备
2-1 添加所有文件
git add .
3.提交代码到仓库
将暂存区(index)中的代码提交(commit)到仓库(repository),提交时必须带提交信息,并且可以多次使用-m来分段 -m “commit title” -m “commit description”
git commit -m “commit title” -m “commit description”
4.关联本地仓库与远程仓库
本地仓库(repository)需要先与远程仓库( remote origin)建立关系
git remote add origin https://gitee.com/yourname/testremote.git
5.本地仓库内容推送到远程仓库
git push 将本地的分支版本上传到远程并合并
git push
6.从远程仓库克隆代码到本地仓库
git clone https://gitee.com/yourname/testremote.git