Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: 添加upstream,同步上游lowcoder_cn仓库代码 #76

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,5 @@
* [添加原生组件](developer/addComponent.md)
* [组件文件简单介绍](developer/component-file.md)
* [打包Docker镜像](developer/build-image.md)
* [同步上游仓库代码](developer/upstream.md)

1 change: 1 addition & 0 deletions docs/developer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* [添加原生组件](developer/addComponent.md)
* [组件文件简单介绍](developer/component-file.md)
* [打包Docker镜像](developer/build-image.md)
* [同步上游仓库代码](developer/upstream.md)

以下以windows WSL2新安装的ubuntu22为例
![Alt text](../assets/image2.png)
Expand Down
58 changes: 58 additions & 0 deletions docs/developer/upstream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
当我们 `fork lowcoder_cn` 仓库后可能会需要与上游仓库同步,最简单的方法是点击 `fork` 仓库主页的 `Sync fork` -> `Update branch`,但当使用`gitlab`等托管代码时,也可以使用 `git upstream`:

#### 步骤一
使用`gitlab`同步 `lowcoder_cn` 的项目后,使用 `git clone` 将仓库克隆到本地,然后运行 `git remote -v` 查看本地的远程仓库,本文以 `gitlab` 为例:
```sh
$ git remote -v
origin http://192.168.1.131/saas-opensource/lowcoder_cn.git (fetch)
origin http://192.168.1.131/saas-opensource/lowcoder_cn.git (push)
```
#### 步骤二
如果没有 `upstream`,添加上游仓库:
```sh
git remote add upstream git@github.com:mousheng/lowcoder_CN.git
```
#### 步骤三
再次查看本地的远程仓库:
```sh
$ git remote -v
origin http://192.168.1.131/saas-opensource/lowcoder_cn.git (fetch)
origin http://192.168.1.131/saas-opensource/lowcoder_cn.git (push)
upstream git@github.com:mousheng/lowcoder_CN.git (fetch)
upstream git@github.com:mousheng/lowcoder_CN.git (push)
```
#### 步骤四
运行 `git fetch upstream` 获取上游仓库的提交:
```sh
$ git fetch upstream
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:mousheng/lowcoder_CN
* [new branch] lowcoder_CN -> upstream/lowcoder_CN
```
#### 步骤五
切换到准备与上游仓库同步的分支(本文为 `lowcoder_CN`):
```sh
$ git checkout lowcoder_CN
```
#### 步骤六
将上游仓库的 commit 合并到本地分支:
```sh
$ git merge upstream/lowcoder_CN
Updating 141fa1c..dfe3645
Fast-forward
README.md | 2 ++
1 file changed, 2 insertions(+)
```
#### 步骤七
如果需要,将本地分支推送到 fork 仓库:
```sh
$ git push origin lowcoder_CN
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/YOU/FORK
141fa1c..dfe3645 main -> main
```

完成!
Loading