Git杂记

常用命令

git config --list
git init
git clone

git add .
git commit -m "desc"

git pull origin master
git push origin master

git status
git log

git branch
git checkout master
git branch dev
git checkout dev

git merage dev

常见流程

  • 本地项目push到gitee
git init
git add .
git commit -m "add all"
git remote add origin git@gitee.com:wupeiliang/test.git
git pull origin master --allow-unrelated-histories
git push origin master
  • 远程仓库
git clone git@gitee.com:wupeiliang/test.git
git add .
git commit -m "add file"
git push origin master

常见错误

  • fatal: refusing to merge unrelated histories(无法进行git pull 操作)

原因:git 版本更新导致git pull无法合并本地与托管平台的项目
修改:最新的版本需要添加--allow-unrelated-histories
git pull origin master --allow-unrelated-histories

Commit message 的格式

feat:新功能(feature)
fix:修补bug
docs:文档(documentation)
style: 格式(不影响代码运行的变动)
refactor:重构(即不是新增功能,也不是修改bug的代码变动)
test:增加测试
chore:构建过程或辅助工具的变动

结束语

  • 天生我才必有用
  • 把所有平凡的事都做好
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值