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 <远程主机名> <远程分支名>
相关推荐
我叫张小白。14 分钟前
PyCharm 集成 Git 与 Gitee
git·pycharm·gitee
小雨青年29 分钟前
Git Bisect 实战:用二分法快速找到引入 Bug 的提交
git·bug
一只大袋鼠41 分钟前
Git (三):Tag 标签管理、图形工具、IDEA 集成与 GitLab 私有化部署
开发语言·git·gitlab
十子木41 分钟前
git 如何恢复特定版本的内容
linux·git
龚礼鹏1 小时前
git相关操作
git
x-cmd1 小时前
[260520] x-cmd v0.9.5:x install 支持 skill 安装,新增 git ci 命令让 AI 帮你写 commit
人工智能·git·ci/cd·agent·install·x-cmd
奶油松果1 小时前
更新本地git地址
git
z200509302 小时前
【linux学习】在linux下使用git提交到gitee
git·学习·gitee
C137的本贾尼17 小时前
Git基本操作(四):删除文件
git
C137的本贾尼17 小时前
撤销修改:三种场景下的“反悔”操作
git