git设置用户名和邮箱地址
git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"
// 检查设置是否成功
git config --global user.name
git config --global user.email
gitee初始化
git init #初始化
git add . #将当前目录加入到git
git commit -m "first commit(提交的描述信息)" #git提交到本地版本库
git remote add origin https://gitee.com/xxxx.git #git本地库连接远程版本库,这一步会有对应输入账号和密码的操作
git push -u origin master #将文件上传到远程版本库master分支
git clone https://gitee.com/xxxx.git #获取git项目
合并分支
git checkout main // 换到目标分支
git merge my-branch // 合并分支
合并某一次特定的代码提交
git cherry-pick <commit-hash>
版本回退到某一次提交
git reset --hard <commit-hash>
git push -f // 强制推送
禁用HTTPS操作时的SSL验证
git config --global http.sslVerify false
提交规范
feat: 新功能(feature)
fix: 修补bug
docs: 文档(documentation)
style: 格式(不影响代码运行的变动)
refactor: 重构(即不是新增功能,也不是修改bug的代码变动)
chore: 构建过程或辅助工具的变动
revert: 撤销,版本回退
perf: 性能优化
test:测试
improvement: 改进
build: 打包
ci: 持续集成
相关报错
-
interactive rebase in progress; onto
执行:git rebase --continue
-
error: remote origin already exists.
执行:git remote rm origin
删除关联的origin的远程库
然后再:git remote add origin https://gitee.com/xxxxxx.git
关联自己的仓库
最后git push origin master
-
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘https://gitee.com/xiaoefen/vue3-web-worker.git’
执行:git pull --rebase origin master
然后再:git push origin master
GitLab上创建了新的分支,但在TortoiseGit上切换分支的时候发现找不到
进入自己的项目中点击右键->打开Git Bash Here
在命令框中输入git remote update origin --prune
更新远程分支列表
重新使用TortoiseGit就可以看见最新的分支了
Node
node v14.21.3(npm v6.14.18)装不上cnpm
指定装低版本的cnpm
npm install -g cnpm@7.1.0 --registry=https://registry.npmmirror.com/