[Docs] Rename master to main (#1397)

This commit is contained in:
Zaida Zhou 2023-10-18 19:13:26 +08:00 committed by GitHub
parent 7495b33f34
commit c65187c6b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 14 deletions

View File

@ -89,16 +89,16 @@ git commit -m "xxx" --no-verify
### 3. Create a development branch
After configuring the pre-commit, we should create a branch based on the master branch to develop the new feature or fix the bug. The proposed branch name is `username/pr_name`
After configuring the pre-commit, we should create a branch based on the main branch to develop the new feature or fix the bug. The proposed branch name is `username/pr_name`
```shell
git checkout -b yhc/refactor_contributing_doc
```
In subsequent development, if the master branch of the local repository is behind the master branch of "upstream", we need to pull the upstream for synchronization, and then execute the above command:
In subsequent development, if the main branch of the local repository is behind the main branch of "upstream", we need to pull the upstream for synchronization, and then execute the above command:
```shell
git pull upstream master
git pull upstream main
```
### 4. Commit the code and pass the unit test
@ -161,18 +161,18 @@ MMEngine will run unit test for the posted Pull Request on different platforms (
### 7. Resolve conflicts
If your local branch conflicts with the latest master branch of "upstream", you'll need to resolove them. There are two ways to do this:
If your local branch conflicts with the latest main branch of "upstream", you'll need to resolove them. There are two ways to do this:
```shell
git fetch --all --prune
git rebase upstream/master
git rebase upstream/main
```
or
```shell
git fetch --all --prune
git merge upstream/master
git merge upstream/main
```
If you are very good at handling conflicts, then you can use rebase to resolve conflicts, as this will keep your commit logs tidy. If you are not familiar with `rebase`, then you can use `merge` to resolve conflicts.

View File

@ -77,13 +77,16 @@ pre-commit run --all-files
<img src="https://user-images.githubusercontent.com/57566630/202368856-0465a90d-8fce-4345-918e-67b8b9c82614.png" width="1200">
```{note}
:::{note}
如果你是中国用户,由于网络原因,可能会出现安装失败的情况,这时可以使用国内源
pre-commit install -c .pre-commit-config-zh-cn.yaml
```bash
pre-commit run --all-files -c .pre-commit-config-zh-cn.yaml
```
如果安装过程被中断,可以重复执行 `pre-commit run ...` 继续安装。
:::
如果安装过程被中断,可以重复执行 `pre-commit run --all-files` 继续安装。
如果提交的代码不符合代码风格规范pre-commit 会发出警告,并自动修复部分错误。
@ -97,16 +100,16 @@ git commit -m "xxx" --no-verify
### 3. 创建开发分支
安装完 pre-commit 之后,我们需要基于 master 创建开发分支,建议的分支命名规则为 `username/pr_name`
安装完 pre-commit 之后,我们需要基于 main 创建开发分支,建议的分支命名规则为 `username/pr_name`
```shell
git checkout -b yhc/refactor_contributing_doc
```
在后续的开发中,如果本地仓库的 master 分支落后于 upstream 的 master 分支,我们需要先拉取 upstream 的代码进行同步,再执行上面的命令
在后续的开发中,如果本地仓库的 main 分支落后于 upstream 的 main 分支,我们需要先拉取 upstream 的代码进行同步,再执行上面的命令
```shell
git pull upstream master
git pull upstream main
```
### 4. 提交代码并在本地通过单元测试
@ -176,14 +179,14 @@ MMEngine 会在不同的平台Linux、Window、Mac基于不同版本的
```shell
git fetch --all --prune
git rebase upstream/master
git rebase upstream/main
```
或者
```shell
git fetch --all --prune
git merge upstream/master
git merge upstream/main
```
如果你非常善于处理冲突,那么可以使用 rebase 的方式来解决冲突,因为这能够保证你的 commit log 的整洁。如果你不太熟悉 `rebase` 的使用,那么可以使用 `merge` 的方式来解决冲突。