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

news2024/11/22 22:10:06

目录

一、邀请开发用户

二、新建远程分支

三、拉取远程分支

四、推送远程分支

五、合并远程分支

六、多分支协作


一、邀请开发用户

在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]# 

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【Web】超级详细的Linux权限提升一站式笔记

目录 一、Linux内核提权 提权原理 提权环境 提权复现 二、SUID提权 SUID介绍 设置SUID SUID提权原理 查找SUID文件 提权介绍 find提权 bash提权 vim提权 python提权 三、计划任务提权 提权原理 提权环境 提权步骤 四、环境变量劫持提权 提权原理 提权环境…

【机器学习】卷积和反向传播

一、说明 自从 AlexNet 在 2012 年赢得 ImageNet 竞赛以来&#xff0c;卷积神经网络 (CNN) 就变得无处不在。从不起眼的 LeNet 到 ResNets 再到 DenseNets&#xff0c;CNN 无处不在。 您是否想知道 CNN 的反向传播中会发生什么&#xff0c;特别是反向传播在 CNN 中的工作原理。…

【知识整理】技术新人的培养计划

一、培养计划落地实操 1. 概要 新人入职&#xff0c;要给予适当的指导&#xff0c;目标&#xff1a; 1、熟悉当前环境&#xff1a; 生活环境&#xff1a;吃饭、交通、住宿、娱乐 工作环境&#xff1a;使用的工具&#xff0c;Mac、maven、git、idea 等 2、熟悉并掌握工作技…

Android---Jetpack Compose学习003

Compose 状态。本文将探索如何在使用 Jetpack Compose 时使用和考虑状态&#xff0c;为此&#xff0c;我们需要构建一个 TODO 应用&#xff0c;我们将构建一个有状态界面&#xff0c;其中会显示可修改的互动式 TODO 列表。 状态的定义。在科学技术中&#xff0c;指物质系统所处…

【C深度解剖】前置++与后置++

简介&#xff1a;本系列博客为C深度解剖系列内容&#xff0c;以某个点为中心进行相关详细拓展 适宜人群&#xff1a;已大体了解C语法同学 作者留言&#xff1a;本博客相关内容如需转载请注明出处&#xff0c;本人学疏才浅&#xff0c;难免存在些许错误&#xff0c;望留言指正 作…

相机图像质量研究(12)常见问题总结:光学结构对成像的影响--炫光

系列文章目录 相机图像质量研究(1)Camera成像流程介绍 相机图像质量研究(2)ISP专用平台调优介绍 相机图像质量研究(3)图像质量测试介绍 相机图像质量研究(4)常见问题总结&#xff1a;光学结构对成像的影响--焦距 相机图像质量研究(5)常见问题总结&#xff1a;光学结构对成…

关于Navicat导入sql文件后er图乱序问题

关于Navicat导入sql文件后er图乱序问题 具体操作如下&#xff1a; 点击左下角刷新旁边的小三角

涤生大数据实战:基于Flink+ODPS历史累计计算项目分析与优化(上)

涤生大数据实战&#xff1a;基于FlinkODPS历史累计计算项目分析与优化&#xff08;一&#xff09; 1.前置知识 ODPS&#xff08;Open Data Platform and Service&#xff09;是阿里云自研的一体化大数据计算平台和数据仓库产品&#xff0c;在集团内部离线作为离线数据处理和存…

数据结构(3) 顺序表存储结构

顺序表存储结构 存储结构顺序结构定义基本操作的实现静态分配问题 动态分配代码功能 顺序表的特点: 顺序表小结顺序表的插入删除插入删除小结 顺序表的查找按位查找按值查找小结 各位小伙伴想要博客相关资料的话关注公众号&#xff1a;chuanyeTry即可领取相关资料&#xff01; …

Codeforces Round 924 E. Modular Sequence

E. Modular Sequence 题意 对于一个长度为 n n n 的数组 a a a&#xff0c;定义它是 g o o d good good 的当且仅当&#xff1a; a 1 x a_1 x a1​x a i a i − 1 y a_{i} a_{i - 1} y ai​ai−1​y 或 a i a i − 1 m o d y i ≥ 2 a_{i} a_{i - 1} mod \hspace{…

【Linux】内核中的链表

&#x1f525;博客主页&#xff1a;PannLZ &#x1f38b;系列专栏&#xff1a;《Linux系统之路》 &#x1f94a;不要让自己再留有遗憾&#xff0c;加油吧&#xff01; 文章目录 链表1.创建和初始化2.创建节点3.添加节点4.删除节点5.遍历 链表 内核开发者只实现了循环双链表&am…

nodejs学习计划--(十)会话控制及https补充

一、会话控制 1.介绍 所谓会话控制就是 对会话进行控制 HTTP 是一种无状态的协议&#xff0c;它没有办法区分多次的请求是否来自于同一个客户端&#xff0c; 无法区分用户 而产品中又大量存在的这样的需求&#xff0c;所以我们需要通过 会话控制 来解决该问题 常见的会话控制…

中科大计网学习记录笔记(十):P2P 应用

前言&#xff1a; 学习视频&#xff1a;中科大郑烇、杨坚全套《计算机网络&#xff08;自顶向下方法 第7版&#xff0c;James F.Kurose&#xff0c;Keith W.Ross&#xff09;》课程 该视频是B站非常著名的计网学习视频&#xff0c;但相信很多朋友和我一样在听完前面的部分发现信…

CSP-动态规划-最长公共子序列(LCS)

一、动态规划 动态规划&#xff08;Dynamic Programming&#xff0c;简称DP&#xff09;主要用于求解可以被分解为相似子问题的复杂问题&#xff0c;特别是在优化问题上表现出色&#xff0c;如最短路径、最大子数组和、编辑距离等。动态规划的核心思想是将原问题分解为较小的子…

【MySQL】MySQL函数学习和总结

&#x1f308;个人主页: Aileen_0v0 &#x1f525;热门专栏: 华为鸿蒙系统学习|计算机网络|数据结构与算法 ​&#x1f4ab;个人格言:“没有罗马,那就自己创造罗马~” #mermaid-svg-Ny0xnYjfHqF7s3aS {font-family:"trebuchet ms",verdana,arial,sans-serif;font-siz…

C++ //练习 6.3 编写你自己的fact函数,上机检查是否正确。

C Primer&#xff08;第5版&#xff09; 练习 6.3 练习 6.3 编写你自己的fact函数&#xff0c;上机检查是否正确。 环境&#xff1a;Linux Ubuntu&#xff08;云服务器&#xff09; 工具&#xff1a;vim 代码块 /********************************************************…

Linux系统中HTTP代理的常见问题及解决方案

亲爱的Linux用户们&#xff0c;是不是有时候觉得HTTP代理就像是一个魔法盒子&#xff0c;让你在数字世界中自由穿梭&#xff1f;但是&#xff0c;就像所有的魔法物品一样&#xff0c;它也会偶尔出点小状况。今天&#xff0c;我们就来一起探讨一下Linux系统中HTTP代理的常见问题…

购物|电商购物小程序|基于微信小程序的购物系统设计与实现(源码+数据库+文档)

电商购物小程序目录 目录 基于微信小程序的购物系统设计与实现 一、前言 二、系统功能设计 三、系统实现 1、用户前台功能实现 2、管理员后台功能实现 四、数据库设计 1、实体ER图 2、具体的表设计如下所示&#xff1a; 五、核心代码 六、论文参考 七、最新计算机毕设…

【原创 附源码】Flutter安卓及iOS海外登录--Tiktok登录最详细流程

最近接触了几个海外登录的平台&#xff0c;踩了很多坑&#xff0c;也总结了很多东西&#xff0c;决定记录下来给路过的兄弟坐个参考&#xff0c;也留着以后留着回顾。更新时间为2024年2月7日&#xff0c;后续集成方式可能会有变动&#xff0c;所以目前的集成流程仅供参考&#…

【数据结构】14 队列(带头结点的链式存储和顺序存储实现)

定义 队列是一个有序线性表&#xff0c;但是队列的插入、删除操作是分别在线性表的两个不同端点进行的。 设一个队列 Q ( a 1 , a 2 , . . . , a n ) Q (a_1, a_2,...,a_n) Q(a1​,a2​,...,an​)&#xff0c;那么 a 1 a_1 a1​被称为队头元素&#xff0c; a n a_n an​为队…