基础命令

基础命令

四个工作区域

  • Workspace: 工作区,就是你平时存放项目代码的地方
  • Index / Stage: 暂存区,用于临时存放你的改动,事实上它只是一个文件,保存即将提交到文件列表信息
  • Repository: 仓库区(或版本库),就是安全存放数据的位置,这里面有你提交到所有版本的数据。其中HEAD指向最新放入仓库的版本
  • Remote: 远程仓库,托管代码的服务器,可以简单的认为是你项目组中的一台电脑用于远程数据交换

【Git】(1)—工作区、暂存区、版本库、远程仓库 - 博客园

常用命令

git add . 当前目录所有文件提到 Stage

git commit -m 提交到 Repository
git commit -m '该次提交说明'

git push 上传到 Remote

基础使用

Git 全局设置:

1
2
git config --global user.name "RChangl"
git config --global user.email "8109793+rchangl@user.noreply.gitee.com"

创建 git 仓库:

1
2
3
4
5
6
git init 
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/rchangl/vue3-stroe.git
git push -u origin "master"

已有仓库?

1
2
3
cd existing_git_repo
git remote add origin https://gitee.com/rchangl/vue3-stroe.git
git push -u origin "master"