git 常用命令 git怎么撤销命令 持续更新中!!!!

基本流程

bash 复制代码
# 拉取仓库
git clone 仓库地址
# 拉取最新版本
git pull
# 本地提交
git add .
git commit -m "本次提交信息!"
# 推送上云
git push

分支

bash 复制代码
# 创建分支
git checkout -b cart
# 删除本机的分支
git branch -d cart
# 切换分支 本地切换到主分支
git checkout master
# 合并cart
git merge cart

配置

bash 复制代码
# git 配置
git config --global user.name "bobby"
git config --global user.email "liyao.pinner@gmail.com"

clone

拉取仓库

bash 复制代码
# 拉取仓库
git clone 仓库地址

add

bash 复制代码
# 代码add
git add .
# 项目同步到本地
git clone ...
# 查看文件状态
git status
# 撤销所有add
git reset .

commit

bash 复制代码
# 撤销commit
git reset --soft HEAD^
# 撤销commit+add(有丢失文件风险)
git reset --hard HEAD^
# 代码commit
git commit
git commit -m "本次提交信息"
# commit 和上次合并
git commit --amend

push

推送上云

bash 复制代码
# 本机的cart分之推送到origin的cart分支
git push origin cart
# 代码push
git push

感谢大家的观看!!!创作不易,如果觉得我写的好的话麻烦点点赞👍支持一下

相关推荐
嘻嘻仙人2 天前
Ubuntu中 git上传自己的项目和二次上传一般流程
git·github
Patrick_Wilson2 天前
Squash Merge 的血缘陷阱:为什么删掉的代码又活了过来
前端·git·程序员
沉浸学习的匿名网友2 天前
什么是 .gitignore?为什么每个 Git 项目几乎都离不开它?
前端·git
深海鱼在掘金3 天前
Git 完全指南 —— 第3章:理解工作区、暂存区、版本库三个核心
git
江华森3 天前
Git 基础筑基:从原理到团队协作的全栈实战
git
JakeJiang3 天前
Git 必备命令指南:从日常高频到项目开发实战
git
叫我少年4 天前
Windows 中安装 git
git
深海鱼在掘金9 天前
Git 完全指南 —— 第1章:Git 概览与版本控制演进
git
noravinsc10 天前
关于Git Flow
git
蜜獾云10 天前
在Git中配置用户名和密码
git