ray-note/工具相关文档/git/Git 笔记.md

44 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

- `git fetch`
- `git fetch` 用来同步远程仓库和本地仓库中的git 信息,查看远程仓库的完整分支结构
- `git fetch` 同步远程仓库的全部log信息
- `git log origin`
`git fetch` 只会同步完整分支结构,不会直接将分支内容进行合并,
所以不推荐 `git pull`
- `git push`
- `git push origin` 将当前分支push到远程仓库
- `git push origin dev:dev` 可用于提交本地的新分支到远程分支
### commit 规范
- 基本格式
`<type>(<scope>): subject`
- 说明
- type (必填)
- feat -- 新功能
- fix/to -- 修复bug
- docs -- 文档
- style -- 格式 (不影响代码)
- refactor -- 重构代码变动没有修改功能也不是修复bug
- perf -- (优化, 替身性能,提升交互体验)
- test -- 增加测试
- chore -- 构建过程或辅助工具的变动
- revert -- 版本回退
- merge -- 代码合并
- sync 同步主线或分支的bug
- scope可选 : 说明commit影响的范围
- subject 必填commit 目的的简短描述
### git 同步个人私有库
在同步个人的私有库时,如果没有配置用户名和密码,会出现如下错误:
`-fatal: repository not found`
这个原因
- 因为没有访问权限,配置用户名和密码,访问令牌没有正确提供
- url错误
使用访问令牌访问私有仓库
`git clone https://access-token@github.com/user_name/repository.git`
- accesstoken 是颁发的令牌
- @后面是正常情况下的url