Github图床

  1. personal access token: ee18b74ac2bbcf1ceca62885e4930d553f43e0c1

推送本地分支到远程分支

两个场景:


    1. 远程有分支,直接将分支拉到本地 进行开发

    1. 本地开启一个新的分支,推送至远程

场景1: 检出远程分支并在本地新建分支

  1. git checkout -b branchname origin/branchname # 捡出远程的branchname分支到本地.
  2. # 第一个`branchname`是你新建本地分支的名字,`origin/branchname ` 指远程分支的名字
  3. git push # 这里直接用push,因为本地分支与远程已建立联系

更换远程仓库地址

通过命令先删除再添加远程仓库

  1. # 查看远程仓库
  2. git remote
  3. # 查看指定远程仓库地址
  4. git remote xxx
  5. # 移除仓库地址
  6. git remote rm origin
  7. # 设置新的仓库地址
  8. git remote add origin IP

场景2: 开启分支并推送至远程

  1. git checkout -b branchname # 创建并切换到本地分支branchname
  2. git push origin branchname:branchname # 推送本地的branchnam(冒号前面的)分支到远程origin的branchname(冒号后面的)分支(远程若没有会自动创建)

Commit Message 的标准格式

Commit Message 标准格式包括三个部分:Header,Body,Footer

  1. <type>(<scope>): <subject>
  2. // 空一行
  3. <body>
  4. // 空一行
  5. <footer>

其中,Header 是必需的,Body 和 Footer 可以省略

Header

Header 部分只有一行,包括三个字段:type(必需)、scope(可选)、subject(必需)

1. type

用于说明类型。

feat 新功能(A new feature)
fix 修复bug(A bug fix)
improvement 对当前功能的改进(An improvement to a current feature)
docs 仅包含文档的修改(Documentation only changes)
style 格式化变动,不影响代码逻辑。比如清除多余空白,删除分号 等
refactor 重构,即不是新增功能,也不是修改bug的代码变动
perf 提高性能的修改(A code change that improves performance)
test 添加或修改测试代码(Adding missing tests or correcting existing tests)
build 构建工具或外部依赖包的修改。比如更新依赖包的版本等 (Changes that affect the build system or external dependencies)
ci 持续集成的配置文件或脚本的修改(Changes to our CI configuration files and scripts)
chore 杂项。其它不修改源代码与测试代码的修改(Other changes that don’t modify src or test files)
revert 撤销某次提交(Reverts a previous commit)

2. scope

用于说明影响的范围,比如数据层、控制层、视图层等等。

3. suject

主题,简短描述。一行

Body

对 subject 的补充。可以多行。

Footer

主要是一些关联 issue 的操作。