【Git版本控制 05】多人协作

目录

一、邀请开发用户

二、新建远程分支

三、拉取远程分支

四、推送远程分支

五、合并远程分支

六、多分支协作


一、邀请开发用户

在windows环境下,再clone同⼀个项⽬仓库,来模拟⼀起协作开发的另⼀名⼩伙伴。

际开发中,每个⽤⼾都有⾃⼰的 gitee/github 账号,如果要多⼈进⾏协同开发,必须要将⽤⼾添加进开发者,⽤⼾才有权限进⾏代码提交:

至此相当于有了两个⽤⼾,分别在linux和windows上针对于同项⽬进⾏协作开发。

二、新建远程分支

⽬前,我们的仓库中只有⼀个maste主分⽀,但在实际的项⽬开发中,在任何情况下其实都是不允许直接在master分⽀上修改代码的,这是为了保证主分⽀的稳定。所以在开发新功能时,常常会新建其他分⽀,供开发时进⾏迭代使⽤。

创建成功的远程分⽀是可以通过Git拉取到本地来,以实现完成本地开发⼯作。

三、拉取远程分支

接下来让我们和另⼀名开发的⼩伙伴都将远程仓库进⾏⼀次拉取操作,并观察结果:

# Linux系统
# git branch 是查看本地分支
# git branch -r 可查看远端分支

(base) [root@localhost git-learning]# git pull
来自 gitee.com:hdu-a-chao/git-learning
 * [新分支]          dev        -> origin/dev
Already up-to-date.
(base) [root@localhost git-learning]# git branch -r
  origin/HEAD -> origin/master
  origin/dev
  origin/master
(base) [root@localhost git-learning]#
# Window系统

C:\Users\pheonixFly\Gitee\git-learning>git pull
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
From https://gitee.com/hdu-a-chao/git-learning
 * [new branch]      dev        -> origin/dev
Already up to date.

C:\Users\pheonixFly\Gitee\git-learning>git branch -r
  origin/HEAD -> origin/master
  origin/dev
  origin/master

C:\Users\pheonixFly\Gitee\git-learning>

拉取后便可以看到远程的dev分⽀,接着切换到dev分⽀供我们进⾏本地开发。

需要注意的是,我们切换到的是本地dev分支,在切换的时候将本地分支和远程分支相连接。

# Linux系统
# git branch -a 是列出所有本地分支和远程分支

(base) [root@localhost git-learning]# git checkout -b dev origin/dev
分支 dev 设置为跟踪来自 origin 的远程分支 dev。
切换到一个新分支 'dev'
(base) [root@localhost git-learning]# git branch -a
* dev
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/dev
  remotes/origin/master
(base) [root@localhost git-learning]#
# Windows系统

C:\Users\pheonixFly\Gitee\git-learning>git checkout dev
Switched to a new branch 'dev'
Branch 'dev' set up to track remote branch 'dev' from 'origin'.

C:\Users\pheonixFly\Gitee\git-learning>

四、推送远程分支

# Linux系统

(base) [root@localhost git-learning]# vim file.txt 
(base) [root@localhost git-learning]# cat file.txt
complete the first function!
(base) [root@localhost git-learning]# git add .
(base) [root@localhost git-learning]# git commit -m "first function"
[dev 25fed23] first function
 1 file changed, 1 insertion(+)
 create mode 100644 file.txt
(base) [root@localhost git-learning]# git push origin dev
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 282 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Powered by GITEE.COM [1.1.5]
remote: Set trace flag 0d4dcf8c
To git@gitee.com:hdu-a-chao/git-learning.git
   8d78346..25fed23  dev -> dev
(base) [root@localhost git-learning]# 

⾄此,我们已经将代码成功推送⾄码云,接下来假如你的⼩伙伴要和你协同开发,碰巧也要对file.txt⽂件作修改,并试图推送。

# Windows系统,推送失败

C:\Users\pheonixFly\Gitee\git-learning>type file.txt
complete the second function

C:\Users\pheonixFly\Gitee\git-learning>git add .

C:\Users\pheonixFly\Gitee\git-learning>git commit -m "second function"
[dev d1b29e4] second function
 1 file changed, 1 insertion(+)
 create mode 100644 file.txt

C:\Users\pheonixFly\Gitee\git-learning>git push origin dev
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
To https://gitee.com/hdu-a-chao/git-learning.git
 ! [rejected]        dev -> dev (fetch first)
error: failed to push some refs to 'https://gitee.com/hdu-a-chao/git-learning.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

C:\Users\pheonixFly\Gitee\git-learning>

推送失败,因为你的⼩伙伴的最新提交和你推送的提交有冲突,解决办法也很简单,Git已经提⽰我们,先⽤ git pull 把最新的提交从 origin/dev 抓下来,然后,在本地进⾏合并,并解决冲突,再推送。

# Windows系统

C:\Users\pheonixFly\Gitee\git-learning>git pull
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
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
Unpacking objects: 100% (3/3), 262 bytes | 37.00 KiB/s, done.
From https://gitee.com/hdu-a-chao/git-learning
   8d78346..25fed23  dev        -> origin/dev
CONFLICT (add/add): Merge conflict in file.txt
Auto-merging file.txt
Automatic merge failed; fix conflicts and then commit the result.

C:\Users\pheonixFly\Gitee\git-learning>type file.txt
<<<<<<< HEAD
complete the second function
=======
complete the first function!
>>>>>>> 25fed23cedd3bf5d229bc6ec6d7b3bdc22863b7b

C:\Users\pheonixFly\Gitee\git-learning>
# Windows系统,修改冲突文件,重新提交

C:\Users\pheonixFly\Gitee\git-learning>type file.txt
complete the first function!
complete the second function!
C:\Users\pheonixFly\Gitee\git-learning>git add file.txt

C:\Users\pheonixFly\Gitee\git-learning>git commit -m "merge dev"
[dev b81ee56] merge dev

C:\Users\pheonixFly\Gitee\git-learning>git push origin dev
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
Enumerating objects: 12, done.
Counting objects: 100% (12/12), done.
Delta compression using up to 16 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (9/9), 839 bytes | 839.00 KiB/s, done.
Total 9 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [1.1.5]
remote: Set trace flag 22432588
To https://gitee.com/hdu-a-chao/git-learning.git
   25fed23..b81ee56  dev -> dev

C:\Users\pheonixFly\Gitee\git-learning>

# Linux系统,查看最新的远程分支版本的代码

(base) [root@localhost git-learning]# git pull
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 9 (delta 3), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (9/9), done.
来自 gitee.com:hdu-a-chao/git-learning
   25fed23..b81ee56  dev        -> origin/dev
更新 25fed23..b81ee56
Fast-forward
 file.txt | 1 +
 1 file changed, 1 insertion(+)
(base) [root@localhost git-learning]# cat file.txt
complete the first function!
complete the second function!(base) [root@localhost git-learning]# 

两名开发者已经开始可以进⾏协同开发了,不断的 git pull/add/commit/push ,遇到了冲突,就使⽤我们之前讲的冲突处理解决掉冲突。

虽然我们是在分⽀上进⾏多⼈协作开发,但最终的⽬的是要将开发后的代码合并到master上去,让我们的项⽬运⾏最新的代码。

五、合并远程分支

# Linux系统
# 1. 切换到 master 分支,pull 一下,保证本地 master 分支是最新内容
# 2. 切换到 dev 分支上合并 master 分支,避免合并冲突发生在 master 分支上
# 3. 切换到 master分支合并 dev分支
# 4. 将 master 分支推送到远程 origin/master 分支

(base) [root@localhost git-learning]# git checkout master
切换到分支 'master'
(base) [root@localhost git-learning]# git pull
Already up-to-date.
(base) [root@localhost git-learning]# git checkout dev
切换到分支 'dev'
(base) [root@localhost git-learning]# git merge master
Already up-to-date.
(base) [root@localhost git-learning]# git checkout master
切换到分支 'master'
(base) [root@localhost git-learning]# git merge dev
更新 8d78346..b81ee56
Fast-forward
 file.txt | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 file.txt
(base) [root@localhost git-learning]# cat file.txt
complete the first function!
complete the second function!(base) [root@localhost git-learning]# git status
# 位于分支 master
# 您的分支领先 'origin/master' 共 4 个提交。
#   (使用 "git push" 来发布您的本地提交)
#
无文件要提交,干净的工作区
(base) [root@localhost git-learning]# git push origin master
Total 0 (delta 0), reused 0 (delta 0)
remote: Powered by GITEE.COM [1.1.5]
remote: Set trace flag f44bd18c
To git@gitee.com:hdu-a-chao/git-learning.git
   8d78346..b81ee56  master -> master
(base) [root@localhost git-learning]# git status
# 位于分支 master
无文件要提交,干净的工作区
(base) [root@localhost git-learning]# 

总结⼀下,在同⼀分⽀下进⾏多⼈协作的⼯作模式通常是这样:

  • ⾸先,可以试图⽤ git push origin branch-name 推送⾃⼰的修改;
  • 如果推送失败,则因为远程分⽀⽐你的本地更新,需要先⽤gitpull试图合并;
  • 如果合并有冲突,则解决冲突,并在本地提交;
  • 没有冲突或者解决掉冲突后,再⽤ git push origin branch-name推送就能成功!
  • 功能开发完毕,将分⽀ merge 进 master,最后删除分⽀。
     

六、多分支协作

⼀般情况下,如果有多需求需要多⼈同时进⾏开发,是不会在⼀个分⽀上进⾏多⼈开发,⽽是⼀个需求或⼀个功能点就要创建⼀个 feature 分⽀。

现在同时有两个需求需要你和你的⼩伙伴进⾏开发,那么你们俩便可以各⾃创建⼀个分⽀来完成⾃⼰的⼯作。

# Linux系统
# 在本地 feature1 分支上编写 function1 并推送到远程 feature1 分支

(base) [root@localhost git-learning]# git branch -a
  dev
* feature-1
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/feature-1
  remotes/origin/feature-2
  remotes/origin/master
(base) [root@localhost git-learning]# vim function1 
(base) [root@localhost git-learning]# cat function1 
Done!
(base) [root@localhost git-learning]# git add function1 
(base) [root@localhost git-learning]# git commit -m "add function1"
# 位于分支 feature-1
无文件要提交,干净的工作区
(base) [root@localhost git-learning]# git push origin feature-1
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 265 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Powered by GITEE.COM [1.1.5]
remote: Set trace flag b946fab3
To git@gitee.com:hdu-a-chao/git-learning.git
   b81ee56..747de46  feature-1 -> feature-1
(base) [root@localhost git-learning]# 
# Windows系统
# 在本地 feature2 分支上编写 function2 并推送到远程 feature2 分支

C:\Users\pheonixFly\Gitee\git-learning>git checkout -b feature-2
Switched to a new branch 'feature-2'

C:\Users\pheonixFly\Gitee\git-learning>type function2
Done!

C:\Users\pheonixFly\Gitee\git-learning>git add function2

C:\Users\pheonixFly\Gitee\git-learning>git commit -m "add function2"
On branch feature-2
nothing to commit, working tree clean

C:\Users\pheonixFly\Gitee\git-learning>git push origin feature-2
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 16 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 271 bytes | 271.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [1.1.5]
remote: Set trace flag 554bf2b4
To https://gitee.com/hdu-a-chao/git-learning.git
   b81ee56..5388bb8  feature-2 -> feature-2

C:\Users\pheonixFly\Gitee\git-learning>

此时,在本地,你看不⻅他新建的⽂档,他看不⻅你新建的⽂档。并且推送各⾃的分⽀时,并没有任何冲突,你俩互不影响。

正常情况下,你俩就可以在⾃⼰的分⽀上进⾏专业的开发了,直到各自的功能实现完毕就合并到远程master分支上。

但天有不测⻛云,你的⼩伙伴突然⽣病了,但需求还没开发完,需要你帮他继续开发,于是他便把 feature-2 分⽀名告诉你了。这时你就需要在⾃⼰的机器上切换到 feature-2 分⽀帮忙继续开发。

# Linux系统,帮助小伙伴开发 function2
# 1. 拉取远端仓库
# 2. 新建本地 feature-2 分支并关联 origin/feature-2
#    若不连接,使用 git push 简写格式会推送失败
# 3. 帮助小伙伴开发 function2 并推送

(base) [root@localhost git-learning]# 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
Unpacking objects: 100% (3/3), done.
来自 gitee.com:hdu-a-chao/git-learning
   b81ee56..5388bb8  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

(base) [root@localhost git-learning]# git branch -a
  dev
* feature-1
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/feature-1
  remotes/origin/feature-2
  remotes/origin/master
(base) [root@localhost git-learning]# git checkout -b feature-2 origin/feature-2
分支 feature-2 设置为跟踪来自 origin 的远程分支 feature-2。
切换到一个新分支 'feature-2'
(base) [root@localhost git-learning]# ls
file1  file1.ini  file1.so  file.ini  file.so  file.txt  function2  README.en.md  README.md
(base) [root@localhost git-learning]# vim function2 
(base) [root@localhost git-learning]# cat function2 
Done!
Help Done!
(base) [root@localhost git-learning]# git add function2 
(base) [root@localhost git-learning]# git commit -m "help done function2"
[feature-2 ead5633] help done function2
 1 file changed, 1 insertion(+)
(base) [root@localhost git-learning]# git push
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 262 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Powered by GITEE.COM [1.1.5]
remote: Set trace flag d943ed88
To git@gitee.com:hdu-a-chao/git-learning.git
   5388bb8..ead5633  feature-2 -> feature-2
(base) [root@localhost git-learning]# 

这时,你的⼩伙伴已经修养的差不多,可以继续进⾏⾃⼰的开发⼯作,那么他⾸先要获取到你帮他开发的内容,然后接着你的代码继续开发,或者你已经帮他开发完了,那他也需要在⾃⼰的电脑上看看你帮他写的代码。

# Windows系统
# 发现并没有 pull 到最新的代码

C:\Users\pheonixFly\Gitee\git-learning>git pull
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
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
Unpacking objects: 100% (3/3), 242 bytes | 26.00 KiB/s, done.
From https://gitee.com/hdu-a-chao/git-learning
   5388bb8..ead5633  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


C:\Users\pheonixFly\Gitee\git-learning>type function2
Done!

C:\Users\pheonixFly\Gitee\git-learning>git status
On branch feature-2
nothing to commit, working tree clean

C:\Users\pheonixFly\Gitee\git-learning>

Pull⽆效的原因是⼩伙伴没有指定本地 feature-2 分⽀与远程 origin/feature-2 分⽀的链接,根据提⽰,设置feature-2和origin/feature-2的链接再重新拉取即可。

# Windows系统

C:\Users\pheonixFly\Gitee\git-learning>git branch --set-upstream-to=origin/feature-2 feature-2
Branch 'feature-2' set up to track remote branch 'feature-2' from 'origin'.

C:\Users\pheonixFly\Gitee\git-learning>git pull
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
Updating 5388bb8..ead5633
Fast-forward
 function2 | 1 +
 1 file changed, 1 insertion(+)

C:\Users\pheonixFly\Gitee\git-learning>type function2
Done!
Help Done!

C:\Users\pheonixFly\Gitee\git-learning>

⽬前,⼩伙伴的本地代码和远端保持严格⼀致。你和你的⼩伙伴可以继续在不同的分⽀下进⾏协同开发了。

各⾃功能开发完毕后,我们需要将代码合并到 master 中才算真正意义上的开发完毕。

# Windows系统
# 小伙伴率先开发完毕,开始 merge

C:\Users\pheonixFly\Gitee\git-learning>git checkout master
Switched to branch 'master'
Your branch is behind 'origin/master' by 4 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

C:\Users\pheonixFly\Gitee\git-learning>git pull
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
Updating 8d78346..b81ee56
Fast-forward
 file.txt | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 file.txt

C:\Users\pheonixFly\Gitee\git-learning>git push origin master
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [1.1.5]
remote: Set trace flag 0645149a
To https://gitee.com/hdu-a-chao/git-learning.git
   b81ee56..ead5633  master -> master

C:\Users\pheonixFly\Gitee\git-learning>
Switched to branch 'master'
Your branch is up to date with 'origin/master'.

C:\Users\pheonixFly\Gitee\git-learning>git merge feature-2
Updating b81ee56..ead5633
Fast-forward
 function2 | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 function2

C:\Users\pheonixFly\Gitee\git-learning>git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

C:\Users\pheonixFly\Gitee\git-learning>git push origin feature-2
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
info: detecting host provider for 'https://gitee.com/'...
Everything up-to-date

C:\Users\pheonixFly\Gitee\git-learning>

当你的⼩伙伴将其代码 merge 到 master 后,这是你也开发完成了,也需要进⾏ merge 到 master 操作。

# Linux系统

(base) [root@localhost git-learning]# git checkout master
切换到分支 'master'
(base) [root@localhost git-learning]# git pull
来自 gitee.com:hdu-a-chao/git-learning
   b81ee56..ead5633  master     -> origin/master
更新 b81ee56..ead5633
Fast-forward
 function2 | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 function2
(base) [root@localhost git-learning]# git checkout feature-1
切换到分支 'feature-1'
(base) [root@localhost git-learning]# git merge master
Merge made by the 'recursive' strategy.
 function2 | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 function2
(base) [root@localhost git-learning]# ls
file1  file1.ini  file1.so  file.ini  file.so  file.txt  function1  function2  README.en.md  README.md
(base) [root@localhost git-learning]# git status
# 位于分支 feature-1
无文件要提交,干净的工作区
(base) [root@localhost git-learning]# git checkout master
切换到分支 'master'
(base) [root@localhost git-learning]# git merge feature-1
更新 ead5633..7111247
Fast-forward
 function1 | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 function1
(base) [root@localhost git-learning]# ls
file1  file1.ini  file1.so  file.ini  file.so  file.txt  function1  function2  README.en.md  README.md
(base) [root@localhost git-learning]# git status
# 位于分支 master
# 您的分支领先 'origin/master' 共 2 个提交。
#   (使用 "git push" 来发布您的本地提交)
#
无文件要提交,干净的工作区
(base) [root@localhost git-learning]# git push origin master
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 307 bytes | 0 bytes/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Powered by GITEE.COM [1.1.5]
remote: Set trace flag 7b48b099
To git@gitee.com:hdu-a-chao/git-learning.git
   ead5633..7111247  master -> master
(base) [root@localhost git-learning]# 

此时, feature-1 和 feature-2 分⽀对于我们来说就没⽤了,那么我们可以直接在远程仓库中将dev分⽀删除掉。

远程分支删除后,但是我么本地 pull 后还是可以看到那些远程仓库已经不存在的分⽀。

使⽤ git remote prune origin 删掉那些远程仓库不存在的分⽀。

# 当我们在Gitee服务器上删除了 feature-1 feature-2

(base) [root@localhost git-learning]# git pull
Already up-to-date.
(base) [root@localhost git-learning]# git branch -a
  dev
  feature-1
  feature-2
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/feature-1
  remotes/origin/feature-2
  remotes/origin/master
(base) [root@localhost git-learning]# git remote prune origin
修剪 origin
URL:git@gitee.com:hdu-a-chao/git-learning.git
 * [已删除] origin/feature-1
 * [已删除] origin/feature-2
(base) [root@localhost git-learning]# git branch -a
  dev
  feature-1
  feature-2
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
(base) [root@localhost git-learning]# 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/378311.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【flink状态管理(三)】StateBackend的整体设计、StateBackend创建说明

文章目录 一. 状态后端概述二. StateBackend的整体设计1. 核心功能2. StateBackend的UML3. 小结 三. StateBackend的加载与初始化1. StateBackend创建概述2. StateBackend创建过程 一. 状态后端概述 StateBackend作为状态存储后端&#xff0c;提供了创建和获取KeyedStateBacke…

【51单片机】实现一个动静态数码管显示项目(超全详解&代码&图示)(5)

前言 大家好吖&#xff0c;欢迎来到 YY 滴单片机 系列 &#xff0c;热烈欢迎&#xff01; 本章主要内容面向接触过单片机的老铁 主要内容含&#xff1a; 欢迎订阅 YY滴C专栏&#xff01;更多干货持续更新&#xff01;以下是传送门&#xff01; YY的《C》专栏YY的《C11》专栏YY…

vue项目打包部署到flask等后端服务里面,实现前后端不分离部署,解决空白页面和刷新页面not fount问题

1. 编译模式一定要设置为esnext&#xff0c;否则会报错&#xff1a; Strict MIME type checking is enforced for module scripts per HTML spec.Expected a JavaScript module script but the server responded with a MIME type of "text/plain". 具体解释可以看vi…

牛客网SQL进阶127: 月总刷题数和日均刷题数

官网链接&#xff1a; 月总刷题数和日均刷题数_牛客题霸_牛客网现有一张题目练习记录表practice_record&#xff0c;示例内容如下&#xff1a;。题目来自【牛客题霸】https://www.nowcoder.com/practice/f6b4770f453d4163acc419e3d19e6746?tpId240 0 问题描述 基于练习记录表…

PyTorch深度学习实战(23)——从零开始实现SSD目标检测

PyTorch深度学习实战&#xff08;23&#xff09;——从零开始实现SSD目标检测 0. 前言1. SSD 目标检测模型1.1 SSD 网络架构1.2 利用不同网络层执行边界框和类别预测1.3 不同网络层中默认框的尺寸和宽高比1.4 数据准备1.5 模型训练 2. 实现 SSD 目标检测2.1 SSD300 架构2.2 Mul…

深度学习的新进展:解析技术演进与应用前景

深度学习的新进展&#xff1a;解析技术演进与应用前景 深度学习&#xff0c;作为人工智能领域的一颗璀璨明珠&#xff0c;一直以来都在不断刷新我们对技术和未来的认知。随着时间的推移&#xff0c;深度学习不断迎来新的进展&#xff0c;这不仅推动了技术的演进&#xff0c;也…

Vue中路由守卫的详细应用

作为一名web前端开发者&#xff0c;我们肯定经常使用Vue框架来构建我们的项目。而在Vue中&#xff0c;路由是非常重要的一部分&#xff0c;它能够实现页面的跳转和导航&#xff0c;提供更好的用户体验。然而&#xff0c;有时我们需要在路由跳转前或跳转后执行一些特定的逻辑&am…

vue3项目中的404页面

vue3项目中的404页面 春节前的最后一篇技术博客了 写了不少vue项目&#xff0c;发现一直没有正确处理404页面。404页面的出现有这么几种可能&#xff1a; 错误输入了页面地址路由连接跳转时&#xff0c;某些路由已经不存在了&#xff0c;而程序员并没有正确处理 也就是说40…

C 语言学习七:指针

指针 指针与地址指针的声明和初始化指针的解引用指针的比较指针和数组指针数组指针和动态内存分配 指针与函数参数指针作为函数参数二级指针 指向函数的指针 指针与地址 指针的声明和初始化 int variable 42; int *ptr &variable; //间接访问 int value *ptr; // valu…

【竞技宝】LOL:369兰博豪取四杀带队翻盘 TES2-0轻取WBG

北京时间2024年2月8日&#xff0c;英雄联盟LPL2024春季赛在昨天迎来第三周第三个比赛日&#xff0c;本日第二场比赛由TES对阵WBG。本场比赛TES中后期团战的处理更加出色&#xff0c;第二局更是在后期凭借369兰博的四杀完成翻盘&#xff0c;TES2-0轻取WBG。以下是本场比赛的详细…

蓝桥杯Web应用开发-CSS3 新特性【练习三:文本阴影】

文本阴影 text-shadow 属性 给文本内容添加阴影的效果。 文本阴影的语法格式如下&#xff1a; text-shadow: x-offset y-offset blur color;• x-offset 是沿 x 轴方向的偏移距离&#xff0c;允许负值&#xff0c;必须参数。 • y-offset 是沿 y 轴方向的偏移距离&#xff0c…

GEE详细教程之:将Landsat8与Landsat9影像合成一个影像

1.前言 因项目需求&#xff0c;需要获取一个研究区的Landsat8影像&#xff0c;但Landsat8重复周期长&#xff0c;加之天气的影响&#xff0c;很难获取影像质量较好的影像。Landsat4/5/7的波段顺序与landsat8不同&#xff0c;除此之外&#xff0c;landsat7影像还需要工具进行条带…

222. 完全二叉树的节点个数 - 力扣(LeetCode)

题目描述 给你一棵 完全二叉树 的根节点 root &#xff0c;求出该树的节点个数。 完全二叉树 的定义如下&#xff1a;在完全二叉树中&#xff0c;除了最底层节点可能没填满外&#xff0c;其余每层节点数都达到最大值&#xff0c;并且最下面一层的节点都集中在该层最左边的若干…

重装系统---首次安装java的JDK

1、去官网或者百度资源选择自己想要下载的jdk版本即可 2、 3、按照步骤安装即可,路径不要更改,默认c盘安装就好,避免后面发生错误。 4、打开电脑的设置,编辑环境变量 这是添加之后的效果 5、再新建一个系统环境变量 6、编辑环境变量Path 添

3.3-媒资管理之MinIo分布式文件系统上传视频

文章目录 媒资管理5 上传视频5.1 需求分析5.2 断点续传技术5.2.1 什么是断点续传5.2.2 分块与合并测试5.2.3 视频上传流程5.2.4 minio合并文件测试 5.3 接口定义5.4 上传分块开发5.4.1 DAO开发5.4.2 Service开发5.4.2.1 检查文件和分块5.4.2.2 上传分块5.4.2.3 上传分块测试 5.…

Ubuntu安装SVN服务并结合内网穿透实现公网访问本地存储文件

&#x1f525;博客主页&#xff1a; 小羊失眠啦. &#x1f3a5;系列专栏&#xff1a;《C语言》 《数据结构》 《C》 《Linux》 《Cpolar》 ❤️感谢大家点赞&#x1f44d;收藏⭐评论✍️ 前些天发现了一个巨牛的人工智能学习网站&#xff0c;通俗易懂&#xff0c;风趣幽默&…

2. Maven 继承与聚合

目录 2. 2.1 继承 2.2继承关系 2.2.1 思路分析 2.2.2 实现 2.1.2 版本锁定 2.1.2.1 场景 2.1.2.2 介绍 2.1.2.3 实现 2.1.2.4 属性配置 2.2 聚合 2.2.1 介绍 2.2.2 实现 2.3 继承与聚合对比 maven1&#xff1a;分模块设计开发 2. 在项目分模块开发之后啊&#x…

【Qt学习笔记】Qt Creator环境下 信号与槽 详解(自定义信号槽、断连、lambda表达式等)

文章目录 1. 信号槽概念1.1 信号的本质1.2 槽的本质1.3 标准信号槽1.4 信号槽 实例 2. 自定义信号槽2.1 自定义槽函数2.2 自定义信号2.3 带参 信号槽 3. 信号槽的意义 与 作用4. 信号槽断连 &#xff08;了解&#xff09;5. lamda表达式的使用5.1 基本用法5.2 捕获局部变量5.3 …

代码随想录算法训练营DAY16 | 二叉树 (3)

一、LeetCode 104 二叉树的最大深度 题目链接&#xff1a;104.二叉树的最大深度https://leetcode.cn/problems/maximum-depth-of-binary-tree/ 思路&#xff1a;采用后序遍历递归求解。 class Solution {int ans 0;public int maxDepth(TreeNode root) {if(root null){retur…

阿里云学生服务器完成验证领取300元无门槛代金券和优惠权益

阿里云高校计划「云工开物」学生和教师均可参与&#xff0c;完成学生认证和教师验证后学生可以免费领取300元无门槛代金券和3折优惠折扣&#xff0c;适用于云服务器等全量公共云产品&#xff0c;订单原价金额封顶5000元/年&#xff0c;阿里云百科aliyunbaike.com分享阿里云高校…