Git 常用指令

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. 添加1个或多个文件夹到暂存区
    bash 复制代码
    git add [file1] [file2]
    1. 添加指定⽬录到暂存区,包括⼦⽬录
    bash 复制代码
    git add [dir]
    1. 添加当前目录下所有文件到暂存区
    bash 复制代码
    git add .
    1. 提交暂存区全部内容到本地仓库中
    bash 复制代码
    git commit -m "message"
  • 克隆远程仓库HTTPS方式

bash 复制代码
git clone https://
  • 推送
bash 复制代码
git push <远程主机名> <远程分支名>
  • 拉取
bash 复制代码
git pull <远程主机名> <远程分支名>
相关推荐
kyriewen4 小时前
别再每次都 Google 了:我整理了前端日常最常踩的 10 个 Git 坑,附速查表
前端·javascript·git
A_Lonely_Cat2 天前
记一次 GitHub 幽灵协作者大清洗:强制重写 Git 历史与穿透 CDN 缓存实践
git·github
和你看星星4 天前
Git rerere:让重复冲突只解决一次
git
嘻嘻仙人8 天前
Ubuntu中 git上传自己的项目和二次上传一般流程
git·github
Patrick_Wilson8 天前
Squash Merge 的血缘陷阱:为什么删掉的代码又活了过来
前端·git·程序员
沉浸学习的匿名网友8 天前
什么是 .gitignore?为什么每个 Git 项目几乎都离不开它?
前端·git
深海鱼在掘金9 天前
Git 完全指南 —— 第3章:理解工作区、暂存区、版本库三个核心
git
江华森9 天前
Git 基础筑基:从原理到团队协作的全栈实战
git
JakeJiang9 天前
Git 必备命令指南:从日常高频到项目开发实战
git
叫我少年10 天前
Windows 中安装 git
git