简介
- Remote 远程仓库
- Repository 本地仓库
- Index/Stage 暂存区
- WorkSpace 工作区
常用命令
-
git init
-
git add * (将文件由工作区 添加到暂存区)
-
git commit -m “新增目录结构” (将暂存区代码 添加至本地仓库)
-
git log (查看不同的版本)
-
git reset --hard ed234234 (版本回退)
-
git remote add origin https://github.com/Geronimomiao/advance.git(添加到远程仓库)
-
git clone https://github.com/xiebruce/PicUploader.git (从远程仓库克隆代码)
-
git pull --rebase origin master(将远程 仓库代码拉下来 并和本地代码合并)
-
git push origin master(将本地 仓库代码推至远程分支)
注意
-
空格 不要连着输
-
第一次使用git 进行git commit时 会报错
- git config --global user.name “Your Name”
- git config --global user.email “email@example.com”
-
改完配置文件需要重新 add 和 commit 操作