rookie-Git

Quick setup

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 全局配置用户名
$ git config --global user.name "username"

# 全局配置邮箱
$ git config --global user.email "eamil@gmail.com"

# 查看git配置信息
$ git config --list

# 查看git用户名
$ git config user.name

# 查看邮箱配置
$ git config user.email

GitHub setup

create a new repository on the command line

1
2
3
4
5
6
7
8
9
10
11
12
13
$ echo "# rookie" >> README.md

$ git init

$ git add README.md

$ git commit -m "Initial commit"

$ git branch -M master

$ git remote add origin git@github.com:arloyee/rookie.git

$ git push -u origin master

…or push an existing repository from the command line

1
2
3
$ git remote add origin git@github.com:arloyee/rookie.git git branch -M master 

$ git push -u origin master

提交规范

主要type

feat: 增加新功能
fix: 修复bug

特殊type

docs: 只改动了文档相关的内容
style: 不影响代码含义的改动,例如去掉空格、改变缩进、增删分号
build: 构造工具的或者外部依赖的改动,例如webpack,npm
refactor: 代码重构时使用
revert: 执行git revert打印的message

暂不使用type

test: 添加测试或者修改现有测试
perf: 提高性能的改动
ci: 与CI(持续集成服务)有关的改动
chore: 不修改src或者test的其他修改,例如构建过程或辅助工具的变动

Pull requests

1
2
3
4
5
# 更改最新的提交消息
$ git commit --amend

# 已将提交推送到 GitHub.com 强制推送含有修正消息的提交
$ git push --force-with-lease origin EXAMPLE-BRANCH

rookie-Git
https://arloyee.github.io/2023/08/25/rookie-Git/
作者
YaYee
发布于
2023年8月25日
许可协议