Mobile Neural Network (MNN) 3.2.1
Mobile Neural Network {MNN} 3.2.1
- 1. MNN
- 2. MNN 3.2.1
- 2.1. Create a new fork
- 2.2. About remote repositories (关于远程仓库)
- 2.3. Configuring a remote repository for a fork
- 2.4. Syncing a fork branch from the command line (从命令行同步分叉分支)
- 2.5. About `git push`
- 2.6. `yongqiang-3.2.1`
- References
1. MNN
2. MNN 3.2.1
MNN
https://github.com/alibaba/MNN
https://github.com/ForeverStrongCheng/MNN
2.1. Create a new fork
2.2. About remote repositories (关于远程仓库)
https://docs.github.com/en/get-started/git-basics/about-remote-repositories
A remote URL is Git’s fancy way of saying “the place where your code is stored.” That URL could be your repository on GitHub, or another user’s fork, or even on a completely different server.
远程 URL 是 Git 一种指示“您的代码存储位置”的绝佳方式。
You can only push to two types of URL addresses:
- An HTTPS URL like
https://github.com/user/repo.git
- An SSH URL, like
git@github.com:user/repo.git
Git associates a remote URL with a name, and your default remote is usually called origin
.
Git 将远程 URL 与名称相关联,你的默认远程通常名为 origin
。
(base) yongqiang@yongqiang:~/mnn_work$ pwd
/home/yongqiang/mnn_work
(base) yongqiang@yongqiang:~/mnn_work$ git clone https://github.com/ForeverStrongCheng/MNN.git
Cloning into 'MNN'...
remote: Enumerating objects: 43906, done.
remote: Counting objects: 100% (2566/2566), done.
remote: Compressing objects: 100% (700/700), done.
remote: Total 43906 (delta 2126), reused 1879 (delta 1865), pack-reused 41340 (from 4)
Receiving objects: 100% (43906/43906), 306.72 MiB | 4.75 MiB/s, done.
Resolving deltas: 100% (29789/29789), done.
Updating files: 100% (6860/6860), done.
(base) yongqiang@yongqiang:~/mnn_work$ cd MNN/
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git status
On branch master
Your branch is up to date with 'origin/master'.nothing to commit, working tree clean
(base) yongqiang@yongqiang:~/mnn_work/MNN$
2.3. Configuring a remote repository for a fork
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/configuring-a-remote-repository-for-a-fork
- List the current configured remote repository for your fork.
列出当前为复刻配置的远程仓库。
$ git remote -v
> origin https://github.com/YOUR-USERNAME/YOUR-FORK.git (fetch)
> origin https://github.com/YOUR-USERNAME/YOUR-FORK.git (push)
- Specify a new remote
upstream
repository that will be synced with the fork.
指定将与分支同步的新远程上游存储库。
git remote add <别名> <远程仓库>
git remote add upstream https://github.com/ORIGINAL-OWNER/ORIGINAL-REPOSITORY.git
- Verify the new
upstream
repository you’ve specified for your fork.
验证为复刻指定的新上游仓库。
$ git remote -v
> origin https://github.com/YOUR-USERNAME/YOUR-FORK.git (fetch)
> origin https://github.com/YOUR-USERNAME/YOUR-FORK.git (push)
> upstream https://github.com/ORIGINAL-OWNER/ORIGINAL-REPOSITORY.git (fetch)
> upstream https://github.com/ORIGINAL-OWNER/ORIGINAL-REPOSITORY.git (push)
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git remote -v
origin https://github.com/ForeverStrongCheng/MNN.git (fetch)
origin https://github.com/ForeverStrongCheng/MNN.git (push)
(base) yongqiang@yongqiang:~/mnn_work/MNN$
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git remote add upstream https://github.com/alibaba/MNN.git
(base) yongqiang@yongqiang:~/mnn_work/MNN$
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git remote -v
origin https://github.com/ForeverStrongCheng/MNN.git (fetch)
origin https://github.com/ForeverStrongCheng/MNN.git (push)
upstream https://github.com/alibaba/MNN.git (fetch)
upstream https://github.com/alibaba/MNN.git (push)
(base) yongqiang@yongqiang:~/mnn_work/MNN$
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git remote show origin
* remote originFetch URL: https://github.com/ForeverStrongCheng/MNN.gitPush URL: https://github.com/ForeverStrongCheng/MNN.gitHEAD branch: masterRemote branches:
...
(base) yongqiang@yongqiang:~/mnn_work/MNN$
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git remote show upstream
* remote upstreamFetch URL: https://github.com/alibaba/MNN.gitPush URL: https://github.com/alibaba/MNN.gitHEAD branch: masterRemote branches:
...
(base) yongqiang@yongqiang:~/mnn_work/MNN$
2.4. Syncing a fork branch from the command line (从命令行同步分叉分支)
Before you can sync your fork with an upstream
repository, you must configure a remote that points to the upstream
repository in Git.
必须先在 Git 中配置指向上游存储库的远程库,然后才能将分支与上游存储库同步。
-
Change the current working directory to your local project.
将当前工作目录更改为您的本地仓库。 -
Fetch the branches and their respective commits from the upstream repository. Commits to
BRANCH-NAME
will be stored in the local branchupstream/BRANCH-NAME
.
从上游仓库获取分支及其各自的提交。对BRANCH-NAME
的提交将保存在本地分支upstream/BRANCH-NAME
中。
$ git fetch upstream
> remote: Counting objects: 75, done.
> remote: Compressing objects: 100% (53/53), done.
> remote: Total 62 (delta 27), reused 44 (delta 9)
> Unpacking objects: 100% (62/62), done.
> From https://github.com/ORIGINAL-OWNER/ORIGINAL-REPOSITORY
> * [new branch] main -> upstream/main
- Check out your fork’s local default branch - in this case, we use
main
/master
.
签出分支的本地默认分支,在本例中,我们使用main
/master
。
$ git checkout main
> Switched to branch 'main'$ git checkout master
> Switched to branch 'master'
- Merge the changes from the
upstream
default branch - in this case,upstream/main
- into your local default branch. This brings your fork’s default branch into sync with theupstream
repository, without losing your local changes.
将上游默认分支 (在本例中为upstream/main
) 的更改合并到本地默认分支中。这会使复刻的默认分支与上游仓库同步,而不会丢失本地更改。
$ git merge upstream/main$ git merge upstream/master
If your local branch didn’t have any unique commits, Git will perform a fast-forward.
如果本地分支没有任何唯一提交,Git 将执行快速转发。
If your local branch had unique commits, you may need to resolve conflicts.
如果本地分支具有唯一提交,则可能需要解决冲突。
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git status
On branch master
Your branch is up to date with 'origin/master'.nothing to commit, working tree clean
(base) yongqiang@yongqiang:~/mnn_work/MNN$
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git remote -v
origin https://github.com/ForeverStrongCheng/MNN.git (fetch)
origin https://github.com/ForeverStrongCheng/MNN.git (push)
upstream https://github.com/alibaba/MNN.git (fetch)
upstream https://github.com/alibaba/MNN.git (push)
(base) yongqiang@yongqiang:~/mnn_work/MNN$
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git fetch upstream
(base) yongqiang@yongqiang:~/mnn_work/MNN$
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git checkout master
Already on 'master'
Your branch is up to date with 'origin/master'.
(base) yongqiang@yongqiang:~/mnn_work/MNN$
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git merge upstream/master
Already up to date.
(base) yongqiang@yongqiang:~/mnn_work/MNN$
Push updates to your fork: After merging changes from the upstream
, push them to your fork to keep it up to date.
$ git push origin main$ git push origin master
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git push origin master
Username for 'https://github.com': ForeverStrongCheng
Password for 'https://ForeverStrongCheng@github.com':
Everything up-to-date
(base) yongqiang@yongqiang:~/mnn_work/MNN$
2.5. About git push
The git push
command takes two arguments:
- A remote name, for example,
origin
- A branch name, for example,
main
For example:
git push REMOTE-NAME BRANCH-NAME
As an example, you usually run git push origin main
to push your local changes to your online repository.
- Renaming branches
To rename a branch, you’d use the same git push
command, but you would add one more argument: the name of the new branch. For example:
git push REMOTE-NAME LOCAL-BRANCH-NAME:REMOTE-BRANCH-NAME
This pushes the LOCAL-BRANCH-NAME
to your REMOTE-NAME
, but it is renamed to REMOTE-BRANCH-NAME
.
- Pushing tags (推送标记)
By default, and without additional parameters, git push
sends all matching branches that have the same names as remote branches.
默认情况下,没有其他参数时,git push
会发送所有名称与远程分支相同的匹配分支。
To push a single tag, you can issue the same command as pushing a branch:
git push REMOTE-NAME TAG-NAME
To push all your tags, you can type the command:
git push REMOTE-NAME --tags
获取 upstream
仓库的所有标签:
(base) yongqiang@yongqiang:~/stable_diffusion_work/diffusers$ git fetch upstream --tags
(base) yongqiang@yongqiang:~/stable_diffusion_work/diffusers$ git tag -l | grep v0.33
v0.33.0
v0.33.1
(base) yongqiang@yongqiang:~/stable_diffusion_work/diffusers$
将从 upstream
获取的 tags
推送到 origin
仓库:
(base) yongqiang@yongqiang:~/stable_diffusion_work/diffusers$ git push origin --tags
- Deleting a remote branch or tag (删除远程分支或标记)
The syntax to delete a branch is a bit arcane at first glance:
git push REMOTE-NAME :BRANCH-NAME
Note that there is a space before the colon. The command resembles the same steps you’d take to rename a branch. However, here, you’re telling Git to push nothing into BRANCH-NAME
on REMOTE-NAME
. Because of this, git push
deletes the branch on the remote repository.
请注意,冒号前有一个空格。命令与重命名分支的步骤类似。但这里是指示 Git 不要将任何内容推送到 REMOTE-NAME
上的 BRANCH-NAME
。因此,git push
会删除远程存储库上的分支。
To push to a branch of a different name, you just need to specify the branch you want to push and the name of the branch you want to push to separated by a colon (:
).
For example, if you want to push a branch called some-branch
to my-feature
:
$ git push origin some-branch:my-feature
$ git push <remote> <local branch name>:<remote branch to push into>
2.6. yongqiang-3.2.1
https://github.com/ForeverStrongCheng/MNN
https://github.com/ForeverStrongCheng/MNN/tree/yongqiang-3.2.1
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git tag | grep 3.2.*
3.2.0
3.2.1
(base) yongqiang@yongqiang:~/mnn_work/MNN$
new-feature-branch
是将要创建的新分支的名字,而 tag-name
是已经存在的 tag
的名字。
git checkout -b new-feature-branch tag-name(base) yongqiang@yongqiang:~/mnn_work/MNN$ git checkout -b yongqiang-3.2.1 3.2.1
Switched to a new branch 'yongqiang-3.2.1'
(base) yongqiang@yongqiang:~/mnn_work/MNN$ git status
On branch yongqiang-3.2.1
nothing to commit, working tree clean
(base) yongqiang@yongqiang:~/mnn_work/MNN$
在开发过程中,可能会有其他人推送了更新到原始的 tag
。可以通过下面的命令来更新你的分支:
git pull --rebase origin tag-name(base) yongqiang@yongqiang:~/mnn_work/MNN$ git pull --rebase origin 3.2.1
From https://github.com/ForeverStrongCheng/MNN* tag 3.2.1 -> FETCH_HEAD
Already up to date.
Current branch yongqiang-3.2.1 is up to date.
(base) yongqiang@yongqiang:~/mnn_work/MNN$
推送你的分支:
git push origin new-feature-branch(base) yongqiang@yongqiang:~/mnn_work/MNN$ git push origin yongqiang-3.2.1
Username for 'https://github.com': ForeverStrongCheng
Password for 'https://ForeverStrongCheng@github.com':
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Create a pull request for 'yongqiang-3.2.1' on GitHub by visiting:
remote: https://github.com/ForeverStrongCheng/MNN/pull/new/yongqiang-3.2.1
remote:
To https://github.com/ForeverStrongCheng/MNN.git* [new branch] yongqiang-3.2.1 -> yongqiang-3.2.1
(base) yongqiang@yongqiang:~/mnn_work/MNN$
References
[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/
[2] MNN, https://github.com/alibaba/MNN
[3] MNN, https://www.yuque.com/mnn