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

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

相关推荐
代码or搬砖16 小时前
Git学习笔记(三)
笔记·git·学习
虾说羊20 小时前
git连接远程仓库并拉去推送以及克隆命令
git
IT~狂男21 小时前
GIT 实战命令操作大全,代码变动,推动,修改备注,撤销(篇幅一)
git
前端拿破轮21 小时前
从0到1搭一个monorepo项目(一)
前端·javascript·git
消失的旧时光-19431 天前
git的 Rebase
git
风禾万里1 天前
Git怎么管理软件版本(代码,模型,配置等)
git
默默coding的程序猿1 天前
3.git的分支携带问题是什么?怎么解决?
java·git·python·svn·gitee·github·intellij-idea
天地人-神君2 天前
将.idea取消git托管
java·git·intellij-idea
Zach_yuan2 天前
版本控制器Git
linux·git
唐青枫2 天前
Git 提交时神秘的 create mode 100644 到底是什么?一文告诉你答案!
git