git 命令

基本命令
git --version 检查git是否安装成功

git status 查看版本状态

git reset --hard HEAD/commitID 版本回滚

git add . 添加版本

git commit -m '' 提交版本

git push origin master 推到远程仓库主线分支

git push -f 强行推送

git revert 撤销提交

git config --global user.name ‘username’ //username git账号

git config --global user.email ‘email ‘ //email git邮箱 配置用户

克隆
git clone 克隆分支

分支命令
git branch 查看分支

git branch dev 创建dev分支

git branch -d dev 删除dev分支

git switch/checkout dev 转换到dev分支

git switch/checkout -b dev 创建并转换到dev分支

git merge 合并分支

强制删除本地分支:git branch -D 分支名称

删除远程分支:git push origin --delete 分支名称

查看历史
git log

git reflog

git log --graph

自定义版 git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

简洁版:  git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
————————————————
版权声明:本文为优快云博主「_Rookie._」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/gu2022_3_5_21_23/article/details/124873982

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值