git使用

一.git安装

二.用户配置

1.本地用户

cpp 复制代码
git config --local user.name//查看全局用户名称
git config --local user.email//查看全局用户邮箱
  • 配置当前项目用户
cpp 复制代码
git config --user.name  "用户名"
git config --user.email  "邮箱名"

2.全局用户

cpp 复制代码
git config --global user.name//查看全局用户名称
git config --global user.email//查看全局用户邮箱
  • 配置全局用户
cpp 复制代码
git config --global user.name  "用户名"
git config --global user.email  "邮箱名"

三.推送到远程仓库

1.初始化本地仓库

cpp 复制代码
git init

2.添加文件到暂存区

cpp 复制代码
git add 文件名//添加指定文件
git add . //添加本目录下所有文件

git status //查看暂存区情况

3.连接远程仓库

cpp 复制代码
git remote//查看远程仓库连接情况
git remote add //自定义远程仓库别名 远程仓库地址

4.获取远程库与本地同步合并

cpp 复制代码
git pull --rebase 自定义的远程仓库别名 合并同步的分支

5.推送到远程仓库

cpp 复制代码
git push -u 自定义远程仓库的别名 远程仓库的分支
相关推荐
养意11 分钟前
git提交代码和解决冲突修复bug
git·bug
码农黛兮_4613 小时前
Git 常用命令大全
git
一弓虽14 小时前
git 学习
git·学习
疯狂的沙粒1 天前
如何通过git命令查看项目连接的仓库地址?
大数据·git·elasticsearch
qq_254617771 天前
Gerrit+repo管理git仓库,如果本地有新分支不能执行repo sync来同步远程所有修改,会报错
git
π大星星️1 天前
Git分布式版本控制工具
分布式·git
kingbal1 天前
IDEA:配置 Git 需要完成 Git 路径设置、账号认证以及仓库关联三个主要步骤
git·idea
司徒小夜1 天前
处理git没做修改,但是文件显示变更的情况
git
m0_749317522 天前
vscode里如何用git
ide·git·vscode
Hello.Reader2 天前
Git 安装全攻略Linux、macOS、Windows 与源码编译
linux·git·macos