git命令
1.远程拉取分支
git init
git remote add origin http://gitlab.os.adc.com/heytap-mall-jimu/jimu-node.git
git fetch origin develop
git checkout -b dev origin/dev
git pull origin develop
2.配置
git config --global user.name "jiajia"
git config --global user.email "123456@qq.com"
git config --list
3.远程拉取覆盖本地
git fetch --all
git reset --hard origin/dev
git checkout [file]
git reset [file]
4.拉取新分支
git checkout -b feature/codereview_20210825 origin/feature/codereview_20210825
git pull origin feature/codereview_20210825
git push origin HEAD:feature/codereview_20210825
5.本地创建分支
git checkout master
git pull origin master
git checkout -b dev-20210915
git push origin dev-20210915 // 把新建的分支push到远端
git branch --set-upstream-to=origin/dev-20210915 // 关联
git pull origin dev-20210915
6.git commit报错
git commit -m'场景建模编辑页-操作样式右侧被覆盖' --no-verify
7.删除分支
git branch -d dev20181018 // 删除本地分支
git branch -D dev20181018 // 如果删除不了可以强制删除
git push origin --delete dev20181018 // 删除远程分支
8.撤销commit操作
git log
git reset --soft HEAD^ // 仅仅撤销commit ,保留add
git reset --hard 9782b748bae84236c115c84b297260df7324a123
10.修改git源
11.分支结构
12.错误汇总
(1)git commit 时,报错"scope may not be empty [scope-empty]"
原因:git commit -m comment 不规范,规范示例: git commit -m"feat(modeA): 枚举&评分字段"