Git 常用指令
-
创建本地仓库
git init(需要进入相应的本地仓库目录) -
配置git
bash
git config [--global] user.name "Your Name"
git config [--global] user.email "email@example.com"
- 删除git配置
bash
git config [--global] --unset user.name
git config [--global] --unset user.email
-
添加文件
- 添加1个或多个文件夹到暂存区
bashgit add [file1] [file2]- 添加指定⽬录到暂存区,包括⼦⽬录
bashgit add [dir]- 添加当前目录下所有文件到暂存区
bashgit add .- 提交暂存区全部内容到本地仓库中
bashgit commit -m "message" -
克隆远程仓库HTTPS方式
bash
git clone https://
- 推送
bash
git push <远程主机名> <远程分支名>
- 拉取
bash
git pull <远程主机名> <远程分支名>