<4>,Git多人协作

<4>,Git多人协作

目录

一,同一分支多人协作

1,协作目标

2,流程图解

(1)先链接在远程仓库和两个本地仓库的master和dev分支。

(2)准备工作完成时状态。

3,协作示例

(1)两种添加本地与远程链接的方式。

(2)开发者1:XShell,提交aaa。

(3)开发者2:PowerShell,提交bbb发现有冲突,拉取XShell提交的aaa,改成aaa和bbb再提交。

(4)将dev合并进master,本地操作。

(5)将dev合并进master,还可以使用申请单合并,远程操作。

二,多个分支多人协作

1,协作目标

2,流程图解

(1)先链接在远程仓库和两个本地仓库的feature-1和feature-2分支。

(2)最后合并feature-1和feature-2到master分支。

3,协作示例

(1)开发者1:XShell,本地创建feature-1分支,新增function1文件,提交并创建远程feature-1分支。

(2)开发者2:PowerShell,本地创建feature-2分支,新增function2文件,提交并创建远程feature-2分支。

(3)你的小伙伴突然生病了 ,但需求还没开发完 ,需要你切换到 feature-2 分支帮他继续开发。

(4)这时 ,你的小伙伴已经修养的差不多了,可以继续进行自己的开发工作,那么他首先要获取到你帮他开发的内容 ,然后接着你的代码继续开发。

(5)将feature-2分支,合并到master分支,在远程上操作。

(6)将master分支,合并到feature-1分支,有冲突在feature-1上解决,本地上完成。

(7)将feature-2分支,合并到master分支,在远程上操作。

(8)把多余分支删除,只留下master,在远程上操作。

(9)同步远程分支


一,同一分支多人协作

1,协作目标

目标:远程master分支下file.txt文件新增代码"aaa"、"bbb"。

实现:由开发者1新增"aaa",由开发者2新增"bbb"。

条件:在一个分支下协作完成。

2,流程图解

(1)先链接在远程仓库和两个本地仓库的master和dev分支。

(2)准备工作完成时状态。

3,协作示例

(1)两种添加本地与远程链接的方式。

让本地dev分支,连接远程dev分支;让本地master分支,连接远程master分支。

// 第一种添加链接的方式 [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/master [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git checkout -b dev origin/dev Branch dev set up to track remote branch dev from origin. Switched to a new branch 'dev' [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git branch -a * dev master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/master [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git branch -vv * dev 35e5808 [origin/dev] text gitignore master 35e5808 [origin/master] text gitignore // 第二种添加链接的方式 PS D:\git\linux-study> git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/master PS D:\git\linux-study> git checkout -b dev Switched to a new branch 'dev' PS D:\git\linux-study> git branch -vv * dev 35e5808 text gitignore master 35e5808 [origin/master] text gitignore PS D:\git\linux-study> git pull There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull <remote> <branch> If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/<branch> dev PS D:\git\linux-study> git branch --set-upstream-to=origin/dev dev branch 'dev' set up to track 'origin/dev'. PS D:\git\linux-study> git branch -vv * dev 35e5808 [origin/dev] text gitignore master 35e5808 [origin/master] text gitignore
(2)开发者1:XShell,提交aaa。
[user@iZwz9eoohx59fs5a6ampomZ linux-study]$ ls a.so b.so c.so file.txt README.en.md README.md [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ cat file.txt hello git hello world [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ vim file.txt [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ cat file.txt hello git hello world aaa [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git add . [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git commit -m "file.txt:aaa" [dev 5beabac] file.txt:aaa [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Counting objects: 8, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (4/4), 443 bytes | 0 bytes/s, done. Total 4 (delta 1), reused 0 (delta 0) remote: Powered by GITEE.COM [1.1.23] remote: Set trace flag 5e464c86 To [email protected]:Goforest/linux-study.git e4a0489..5beabac dev -> dev
(3)开发者2:PowerShell,提交bbb发现有冲突,拉取XShell提交的aaa,改成aaa和bbb再提交。
PS D:\git\linux-study> cat .\file.txt hello git hello world bbb PS D:\git\linux-study> git add . PS D:\git\linux-study> git commit -m "file.txt:bbb" [dev c7a765a] file.txt:bbb 1 file changed, 1 insertion(+) PS D:\git\linux-study> git push ** WARNING: connection is not using a post-quantum key exchange algorithm. ** This session may be vulnerable to "store now, decrypt later" attacks. ** The server may need to be upgraded. See https://openssh.com/pq.html To gitee.com:Goforest/linux-study.git ! [rejected] dev -> dev (fetch first) error: failed to push some refs to 'gitee.com:Goforest/linux-study.git' hint: Updates were rejected because the remote contains work that you do not hint: have locally. This is usually caused by another repository pushing to hint: the same ref. If you want to integrate the remote changes, use hint: 'git pull' before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. PS D:\git\linux-study> git pull ** WARNING: connection is not using a post-quantum key exchange algorithm. ** This session may be vulnerable to "store now, decrypt later" attacks. ** The server may need to be upgraded. See https://openssh.com/pq.html remote: Enumerating objects: 8, done. remote: Counting objects: 100% (8/8), done. remote: Compressing objects: 100% (3/3), done. remote: Total 4 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0) Unpacking objects: 100% (4/4), 423 bytes | 42.00 KiB/s, done. From gitee.com:Goforest/linux-study e4a0489..5beabac dev -> origin/dev Auto-merging file.txt CONFLICT (content): Merge conflict in file.txt Automatic merge failed; fix conflicts and then commit the result. PS D:\git\linux-study> cat .\file.txt hello git hello world aaa bbb PS D:\git\linux-study> git add . PS D:\git\linux-study> git commit -m "pull merge dev" [dev 568e9db] pull merge dev PS D:\git\linux-study> git push ** WARNING: connection is not using a post-quantum key exchange algorithm. ** This session may be vulnerable to "store now, decrypt later" attacks. ** The server may need to be upgraded. See https://openssh.com/pq.html Enumerating objects: 10, done. Counting objects: 100% (10/10), done. Delta compression using up to 12 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (6/6), 539 bytes | 539.00 KiB/s, done. Total 6 (delta 2), reused 0 (delta 0), pack-reused 0 (from 0) remote: Powered by GITEE.COM [1.1.23] remote: Set trace flag 4446e7b1 To gitee.com:Goforest/linux-study.git 5beabac..568e9db dev -> dev
(4)将dev合并进master,本地操作。
[user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git checkout master Switched to branch 'master' [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git pull Already up-to-date. [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git checkout dev Switched to branch 'dev' [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git merge master Already up-to-date. [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git checkout master Switched to branch 'master' [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git merge dev Updating 35e5808..568e9db Fast-forward .gitignore | 1 - file.txt | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 file.txt [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ cat file.txt hello git hello world aaa bbb
(5)将dev合并进master,还可以使用申请单合并,远程操作。

二,多个分支多人协作

1,协作目标

目标:远程master分支下,新增function1和function2 文件。

实现:由开发者1新增function1,由开发者2新增function2。

条件:在不同分支下协作完成,各自让某一个功能私有某一个分支。

2,流程图解

(1)先链接在远程仓库和两个本地仓库的feature-1和feature-2分支。

(2)最后合并feature-1和feature-2到master分支。

3,协作示例

(1)开发者1:XShell,本地创建feature-1分支,新增function1文件,提交并创建远程feature-1分支。
[user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git branch -a dev * master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/master [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git checkout -b feature-1 Switched to a new branch 'feature-1' [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ vim function1 [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git add . [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git commit -m "add func1" [feature-1 cf453ee] add func1 1 file changed, 2 insertions(+) create mode 100644 function1 [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ cat function1 i am coding...... Done [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git push origin feature-1 Counting objects: 4, done. Delta compression using up to 2 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 278 bytes | 0 bytes/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: Powered by GITEE.COM [1.1.23] remote: Set trace flag 0d4ecca7 remote: Create a pull request for 'feature-1' on Gitee by visiting: remote: https://gitee.com/Goforest/linux-study/pull/new/Goforest:feature-1...Goforest:master To [email protected]:Goforest/linux-study.git * [new branch] feature-1 -> feature-1 [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git branch -a dev * feature-1 master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/feature-1 remotes/origin/master
(2)开发者2:PowerShell,本地创建feature-2分支,新增function2文件,提交并创建远程feature-2分支。
PS D:\git\linux-study> git branch -a * dev master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/master PS D:\git\linux-study> git checkout master Switched to branch 'master' Your branch is up to date with 'origin/master'. PS D:\git\linux-study> git pull ** WARNING: connection is not using a post-quantum key exchange algorithm. ** This session may be vulnerable to "store now, decrypt later" attacks. ** The server may need to be upgraded. See https://openssh.com/pq.html remote: Enumerating objects: 4, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0) Unpacking objects: 100% (3/3), 258 bytes | 21.00 KiB/s, done. From gitee.com:Goforest/linux-study 35e5808..568e9db master -> origin/master * [new branch] feature-1 -> origin/feature-1 Updating 35e5808..568e9db Fast-forward .gitignore | 1 - file.txt | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 file.txt PS D:\git\linux-study> git checkout -b feature-2 Switched to a new branch 'feature-2' PS D:\git\linux-study> cat .\function2.txt i am coding...... PS D:\git\linux-study> git add . PS D:\git\linux-study> git commit -m "add func2" [feature-2 439ca94] add func2 1 file changed, 1 insertion(+) create mode 100644 function2.txt PS D:\git\linux-study> git push origin feature-2 ** WARNING: connection is not using a post-quantum key exchange algorithm. ** This session may be vulnerable to "store now, decrypt later" attacks. ** The server may need to be upgraded. See https://openssh.com/pq.html Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 12 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 276 bytes | 276.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0) remote: Powered by GITEE.COM [1.1.23] remote: Set trace flag 9f46f696 remote: Create a pull request for 'feature-2' on Gitee by visiting: remote: https://gitee.com/Goforest/linux-study/pull/new/Goforest:feature-2...Goforest:master To gitee.com:Goforest/linux-study.git * [new branch] feature-2 -> feature-2 PS D:\git\linux-study> git branch -a dev * feature-2 master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/feature-1 remotes/origin/feature-2 remotes/origin/master
(3)你的小伙伴突然生病了 ,但需求还没开发完 ,需要你切换到 feature-2 分支帮他继续开发。

正常情况下 ,你俩就可以在自己的分支上进行专业的开发了!但天有不测风云 ,你的小伙伴突然生病了 ,但需求还没开发完 ,需要你帮他继续开发,于是他便把feature-2 分支名告诉你了。这时你就需要在自己的机器上切换到 feature-2 分支帮他继续开发。

[user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git branch -a dev * feature-1 master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/feature-1 remotes/origin/master [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git pull remote: Enumerating objects: 4, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0) Unpacking objects: 100% (3/3), done. From gitee.com:Goforest/linux-study * [new branch] feature-2 -> origin/feature-2 There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details git pull <remote> <branch> If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/<branch> feature-1 [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git branch -a dev * feature-1 master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/feature-1 remotes/origin/feature-2 remotes/origin/master [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git checkout -b feature-2 origin/feature-2 Branch feature-2 set up to track remote branch feature-2 from origin. Switched to a new branch 'feature-2' [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ ll total 16 -rw-rw-r-- 1 user user 0 Dec 25 10:50 a.so -rw-rw-r-- 1 user user 0 Dec 25 10:50 b.so -rw-rw-r-- 1 user user 0 Dec 25 10:50 c.so -rw-rw-r-- 1 user user 30 Dec 26 16:20 file.txt -rw-rw-r-- 1 user user 17 Dec 28 22:50 function2.txt -rw-rw-r-- 1 user user 43 Dec 25 10:29 README.en.md -rw-rw-r-- 1 user user 67 Dec 25 10:30 README.md [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ cat function2.txt i am coding...... [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ vim function2.txt [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ cat function2.txt i am coding...... help friend coding...... [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git add . [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git commit -m "func2 help coding"[feature-2 13e973c] func2 help coding 1 file changed, 2 insertions(+), 1 deletion(-) [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Counting objects: 5, done. Delta compression using up to 2 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 277 bytes | 0 bytes/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: Powered by GITEE.COM [1.1.23] remote: Set trace flag 15421eb2 To [email protected]:Goforest/linux-study.git 439ca94..13e973c feature-2 -> feature-2
(4)这时 ,你的小伙伴已经修养的差不多了,可以继续进行自己的开发工作,那么他首先要获取到你帮他开发的内容 ,然后接着你的代码继续开发。
PS D:\git\linux-study> git pull ** WARNING: connection is not using a post-quantum key exchange algorithm. ** This session may be vulnerable to "store now, decrypt later" attacks. ** The server may need to be upgraded. See https://openssh.com/pq.html remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0) Unpacking objects: 100% (3/3), 257 bytes | 32.00 KiB/s, done. From gitee.com:Goforest/linux-study 439ca94..13e973c feature-2 -> origin/feature-2 There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull <remote> <branch> If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/<branch> feature-2 PS D:\git\linux-study> git branch --set-upstream-to=origin/feature-2 feature-2 branch 'feature-2' set up to track 'origin/feature-2'. PS D:\git\linux-study> git pull ** WARNING: connection is not using a post-quantum key exchange algorithm. ** This session may be vulnerable to "store now, decrypt later" attacks. ** The server may need to be upgraded. See https://openssh.com/pq.html Updating 439ca94..13e973c Fast-forward function2.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) PS D:\git\linux-study> cat .\function2.txt i am coding...... help friend coding...... PS D:\git\linux-study> cat .\function2.txt i am coding...... help friend coding...... Done! PS D:\git\linux-study> git push ** WARNING: connection is not using a post-quantum key exchange algorithm. ** This session may be vulnerable to "store now, decrypt later" attacks. ** The server may need to be upgraded. See https://openssh.com/pq.html Everything up-to-date PS D:\git\linux-study> git add . PS D:\git\linux-study> git commit -m "func2 done" [feature-2 17c254c] func2 done 1 file changed, 1 insertion(+) PS D:\git\linux-study> git push ** WARNING: connection is not using a post-quantum key exchange algorithm. ** This session may be vulnerable to "store now, decrypt later" attacks. ** The server may need to be upgraded. See https://openssh.com/pq.html Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 12 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 275 bytes | 275.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0) remote: Powered by GITEE.COM [1.1.23] remote: Set trace flag 234544ac To gitee.com:Goforest/linux-study.git 13e973c..17c254c feature-2 -> feature-2 PS D:\git\linux-study>
(5)将feature-2分支,合并到master分支,在远程上操作。

(6)将master分支,合并到feature-1分支,有冲突在feature-1上解决,本地上完成。
[user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git branch -a dev feature-1 * feature-2 master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/feature-1 remotes/origin/feature-2 remotes/origin/master [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git checkout master Switched to branch 'master' [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git pull remote: Enumerating objects: 7, done. remote: Counting objects: 100% (7/7), done. remote: Compressing objects: 100% (3/3), done. remote: Total 4 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0) Unpacking objects: 100% (4/4), done. From gitee.com:Goforest/linux-study 568e9db..f1222f2 master -> origin/master 13e973c..17c254c feature-2 -> origin/feature-2 Updating 568e9db..f1222f2 Fast-forward function2.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 function2.txt [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git checkout feature-1 Switched to branch 'feature-1' [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git merge master Merge made by the 'recursive' strategy. function2.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 function2.txt [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git push origin feature-1 Counting objects: 6, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 1.19 KiB | 0 bytes/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: Powered by GITEE.COM [1.1.23] remote: Set trace flag 7f46b1a0 To [email protected]:Goforest/linux-study.git cf453ee..b39a405 feature-1 -> feature-1
(7)将feature-2分支,合并到master分支,在远程上操作。

(8)把多余分支删除,只留下master,在远程上操作。

(9)同步远程分支

本地使用git remote prune origin同步已删除的远程分支,解决使用git branch -a时显示已删除分支的问题。

[user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git branch -a dev feature-1 feature-2 * master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/feature-1 remotes/origin/feature-2 remotes/origin/master [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git remote show origin * remote origin Fetch URL: [email protected]:Goforest/linux-study.git Push URL: [email protected]:Goforest/linux-study.git HEAD branch: master Remote branches: master tracked refs/remotes/origin/dev stale (use 'git remote prune' to remove) refs/remotes/origin/feature-1 stale (use 'git remote prune' to remove) refs/remotes/origin/feature-2 stale (use 'git remote prune' to remove) Local branches configured for 'git pull': dev merges with remote dev feature-2 merges with remote feature-2 master merges with remote master Local ref configured for 'git push': master pushes to master (local out of date) [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git remote prune origin Pruning origin URL: [email protected]:Goforest/linux-study.git * [pruned] origin/dev * [pruned] origin/feature-1 * [pruned] origin/feature-2 [user@iZwz9eoohx59fs5a6ampomZ linux-study]$ git branch -a dev feature-1 feature-2 * master remotes/origin/HEAD -> origin/master remotes/origin/master

点个赞吧666!或者点个关注也行呀!OVO

Read more

Gitee迁移GitHub开源全攻略:一键配置自动同步,仅需维护单一仓库

Gitee迁移GitHub开源全攻略:一键配置自动同步,仅需维护单一仓库

多数国内开发者习惯使用Gitee托管代码,兼顾访问速度与协作便捷性。当项目需要面向全球开源、接入开源社区时,GitHub是更适配的平台。但手动在两个平台重复提交、同步分支,不仅增加开发成本,还容易出现提交历史不一致、分支冲突、版本遗漏等问题。 本文针对从Gitee迁移项目至GitHub开源、仅提交一端即可实现双平台自动同步的核心需求,提供完整迁移流程、三种自动化同步方案,以及可直接复制的命令与配置清单,一次配置永久生效,彻底告别手动同步。 一、前期准备:基础环境与权限配置 开始迁移与同步前,先完成基础配置,避免权限报错、推送失败等问题,所有命令可直接复制执行。 1. 前置检查 * 清理项目中敏感信息(密钥、密码、内网配置、测试凭证) * 确认Gitee仓库拥有所有者/管理员权限 * GitHub完成邮箱验证,新建仓库权限正常 配置SSH密钥(双平台通用,无密码推送) # 生成SSH密钥(一路回车,无需设置密码) ssh-keygen -t ed25519 -C "你的注册邮箱"

By Ne0inhk
【git】报错 fatal: not a git repository (or any of the parent directories): .git 的原因与解决

【git】报错 fatal: not a git repository (or any of the parent directories): .git 的原因与解决

一、错误原因 在当前目录下执行和 git 相关的命令:通过 git status 查看当前仓库状态、通过 git pull 拉取代码.... 发生报错提示:fatal: not a git repository (or any of the parent directories): .git 错误信息表明当前 你所在的目录并不是一个 git 仓库,或者任何父目录下都没有 .git 目录 (注:一个git仓库中的  .git 目录代表本地的存储仓库,存放本地提交代码) 二、解决问题 方法一:确认当前目录为 Git 仓库的根目录         需要跳转到一个包含 .git 目录的 Git 仓库目录中,或

By Ne0inhk

5个Git-RSCLIP创意应用场景:从科研到商业落地

5个Git-RSCLIP创意应用场景:从科研到商业落地 1. 引言:重新认识遥感图像的价值 遥感图像曾经只是专业人士的专属领域,需要经过专门训练才能解读那些看似模糊的卫星照片。但Git-RSCLIP的出现改变了这一切——现在任何人都能用简单的文字与遥感图像"对话"。 Git-RSCLIP是一个基于10万张遥感图像训练的多模态模型,它能够理解图像内容并用自然语言进行描述和检索。无论是河流、森林、城市还是农田,只需用简单的文字描述,模型就能准确识别并给出匹配度评分。 本文将带你探索Git-RSCLIP在5个不同领域的创新应用,从科研分析到商业决策,展示这个强大工具如何让遥感技术变得人人可用。 2. Git-RSCLIP核心功能解析 2.1 零样本图像分类:无需训练的智能识别 Git-RSCLIP最令人印象深刻的功能是零样本分类能力。你不需要预先训练模型识别特定地物,只需提供几个候选描述,模型就能自动计算每个描述与图像的匹配概率。 # 示例候选文本描述 candidate_descriptions = [ "a remote sensing image of river"

By Ne0inhk

Qwen3.5 开源全解析:从 0.8B 到 397B,代际升级 + 全场景选型指南

摘要 2026 年除夕夜,阿里通义千问正式发布Qwen3.5 开源模型家族,从 0.8B 端侧小模型到 397B 旗舰 MoE 模型全覆盖。本文深度对比 Qwen3.5 与前代 Qwen3 的核心升级,拆解全参数版本差异、优势与落地场景,帮开发者快速选型、高效部署。 前言 大模型行业早已告别 “参数内卷”,转向效率、多模态、低成本落地。Qwen3.5 不是简单的版本迭代,而是通义千问在架构、训练、推理、生态上的代际突破,全面开源(Apache 2.0 协议),让个人开发者、中小企业都能用最低成本跑起最强性能。 一、Qwen3.5 vs Qwen3:四大核心升级

By Ne0inhk