<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

【obsidian】插件Git 使用以及设置详细说明

【obsidian】插件Git 使用以及设置详细说明

概述 为了建立笔记体系,逐步开始使用obsidian记录笔记。 使用过程中为了数据同步以及防止数据丢失,选择夸克网盘以及阿里云云效进行数据备份(云效是阿里云企业级一站式研发协同平台) 操作 线上仓库准备 * 免费注册阿里云云效,(https://www.aliyun.com/product/yunxiao/) * 创建完成后,可看到上传教程,能获取到 https 地址 在代码管理中创建仓库 进入工作台,选择代码管理 obsidian操作 * 安装插件 git * * 设置git插件 * 设置git提交过滤文件,避免很多无效的内容提交; 命令行 Git: Edit .gitignore 在文本框中填写忽略内容格式 ⚠️这里会使用大量的命令行;命令行快捷键 【cmd+p】/ 【Ctrl+P】 在市场中搜索git,在当前页面中完成安装并启用 设置页面-第三方插件-社区市场插件-浏览 (会要求关闭安全模式) # 日志文件 *.log # 软件缓存文件 .obsidian/cache/.obsidian/

By Ne0inhk
Git 高级用法实战指南:从协作到故障恢复,效率提升十倍

Git 高级用法实战指南:从协作到故障恢复,效率提升十倍

Git 是程序员必备的版本控制工具,绝大多数开发者都掌握了 git add、git commit、git push、git pull 等基础用法。但在多人协作、复杂版本管理、故障恢复等场景下,基础用法远远不够用:分支混乱导致代码冲突不断,误提交敏感信息无法撤回,合并代码时引入 Bug 难以定位,版本回滚时操作失误导致代码丢失…… 这些问题每天都在消耗开发者的时间,降低团队协作效率。 实际上,Git 提供了强大的高级功能,能完美解决这些痛点:rebase 让提交历史更整洁,cherry-pick 实现精准代码移植,stash 临时保存工作进度,reset/revert 安全回滚版本,git flow 规范分支管理…… 掌握这些高级用法,能让你从 Git 新手蜕变为 Git 高手,协作效率提升十倍,轻松应对各种复杂场景。本文结合实战场景,拆解

By Ne0inhk
geo优化工具geo源码完全开源部署搭建

geo优化工具geo源码完全开源部署搭建

开源GEO优化工具部署指南 GEO(基因表达 Omnibus)优化工具通常指用于分析基因表达数据的开源工具,以下为完全开源部署的典型方案: 环境准备 * 操作系统:Linux(推荐Ubuntu 20.04+)或Windows Subsystem for Linux * 依赖工具:Docker 20.10+、Python 3.8+、R 4.0+ * 硬件要求:至少4核CPU/8GB内存/50GB存储空间 获取源码 常见开源GEO工具库可通过Git克隆: bash复制插入 git clone https://github.com/geopython/geoapi.git git clone https://github.com/bioconductor/GEOquery 复制插入 数据库部署

By Ne0inhk
告别文件上传限制!Gemini读取GitHub仓库开发大型项目教程(超详细图文版)

告别文件上传限制!Gemini读取GitHub仓库开发大型项目教程(超详细图文版)

在大型项目开发中,用Gemini辅助开发时,不少开发者都会陷入文件上传的困境——单次上传数量、大小受限,无法完整提交全部代码,导致AI缺失项目上下文,难以识别模块依赖,代码调整低效且易出错。本文针对性解决这一痛点,核心方案的是通过GitHub托管项目全量代码,让Gemini直接读取仓库内容,获取完整开发上下文。全文全程实操、零门槛,覆盖仓库准备、关联授权、读取开发全流程,新手也能轻松上手,高效用Gemini助力大型项目开发。 一、GitHub仓库准备+代码上传 1.1 GitHub端:注册/登录账号,新建仓库 这一步之前已经介绍过了,此处不再详细说明,详情可参考PyCharm通过Git指令上传代码到GitHub仓库 1.2 Gemini端:登录账号 网上有很多如何注册学生优惠的Gemini账号,当然不想麻烦市面上页有很多成品号出售,但是切记科学上网的节点要始终保持一致,笔者因为频繁切换节点已经被封了2个Gemini账号了。 二、关键步骤:让Gemini读取GitHub仓库(核心实操) 2.1 Gemini直接输入GitHub仓库链接,自动解析读取 【注】:这种方式导

By Ne0inhk