【Git】08 多人单分支协作场景


文章目录

  • 一、场景1:不同人修改不同文件
    • 1.1 场景描述
    • 1.2 场景复现
      • 1.2.1 克隆到本地
      • 1.2.2 新建分支
      • 1.2.3 B修改、提交与推送
      • 1.2.4 A修改与提交
      • 1.2.5 B再次修改并推送
      • 1.2.6 A推送报错
    • 1.3 解决
  • 二、场景2:不同人修改同文件的不同区域
    • 2.1 场景描述
    • 2.2 场景复现
      • 2.2.1 B修改内容
      • 2.2.2 A修改内容并推送
      • 2.2.3 B推送报错
    • 2.3 解决
  • 三、场景3:不同人修改同文件的同区域
    • 3.1 场景描述
    • 3.2 场景复现
      • 3.2.1 用户A修改提交并推送
      • 3.2.2 用户B修改提交遇报错
    • 3.3 解决
  • 四、场景4:同时变更文件名和内容
    • 4.1 场景描述
    • 4.2 场景复现
      • 4.2.1 用户A修改文件名
    • 4.2.2 用户B修改文件内容
      • 4.2.3 用户Apush到远端
      • 4.2.4 用户Bpush到远端报错
    • 4.3 解决
  • 五、场景5:多人把同一文件改成不同名称
    • 5.1 场景描述
    • 5.2 场景复现
      • 5.2.1 用户A修改名称
      • 5.2.2 用户B修改文件名
      • 5.2.3 用户Apush报错
    • 5.3 解决
  • 六、总结


一、场景1:不同人修改不同文件

1.1 场景描述

假定A、B两用户对Git项目做操作,遇到场景:B在提交了一次commit之后,A将项目clone了下来,并在此基础上进行操作,但B又继续进行操作更新(对不同文件进行修改)并再次提交了commit到服务端。

1.2 场景复现

1.2.1 克隆到本地

用户B将远端库上的项目代码clone到本地,准备在此基础上进行项目代码的修改:

git clone https://gitee.com/asdfv1929/test.git testgit config --add --local user.name tom
git config --add --local user.email tom@163.com

1.2.2 新建分支

在远端库Web端仓库中新建分支,用于测试环境:
在这里插入图片描述

B的本地端更新远程库,将新建的分支纳入到本地:

git remote update
Fetching gitee
From https://gitee.com/asdfv1929/test* [new branch]      add_commands -> gitee/add_commandsgit branch -av
* master                     73c6ad9 merge readmetemp                       1395813 add readmeremotes/gitee/add_commands 73c6ad9 merge readmeremotes/gitee/master       73c6ad9 merge readmeremotes/gitee/temp         1395813 add readme

1.2.3 B修改、提交与推送

B进入到新分支中,修改其下的readme文件内容,并最终推送到远端服务器上。

git checkout -b add_commands gitee/add_commands
Switched to a new branch 'add_commands'
branch 'add_commands' set up to track 'gitee/add_commands'.~/Desktop/test (add_commands)
vi readme~/Desktop/test (add_commands)
git add -u~/Desktop/test (add_commands)
git status
On branch add_commands
Your branch is up to date with 'gitee/add_commands'.Changes to be committed:(use "git restore --staged <file>..." to unstage)modified:   readme~/Desktop/test (add_commands)
git commit -m 'add commands in readme'
[add_commands a82933e] add commands in readme1 file changed, 2 insertions(+)~/Desktop/test (add_commands)
git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 6 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 310 bytes | 103.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/asdfv1929/test.git73c6ad9..a82933e  add_commands -> add_commands

1.2.4 A修改与提交

用户A看到了B的最新一次提交后,准备在此基础上修改add_commands分支上的文件内容。

git branch -av
* master                      73c6ad9 merge readmeremotes/origin/HEAD         -> origin/masterremotes/origin/add_commands a82933e add commands in readmeremotes/origin/master       73c6ad9 merge readmeremotes/origin/temp         1395813 add readme# 切换到分支上,若本地没有则自动创建,并与远程库中的同步分支进行关联
git checkout -b add_commands origin/add_commands
Switched to a new branch 'add_commands'
branch 'add_commands' set up to track 'origin/add_commands'.

用户A在分支中修改了另一个文件file1的内容,并进行了commit。

vi file1git commit -am 'edit file1'
warning: LF will be replaced by CRLF in file1.
The file will have its original line endings in your working directory
[add_commands 4fc78ae] edit file11 file changed, 1 insertion(+)

注意,此时A并未push到远端库上!

1.2.5 B再次修改并推送

在用户A提交了commit但尚未push到远端服务器时,用户B又一次更新了,并且push到了远端上:

vi readme~/Desktop/test (add_commands)
git commit -am "second edit of B"
[add_commands 88ea401] second edit of B1 file changed, 1 insertion(+)~/Desktop/test (add_commands)
git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 6 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 289 bytes | 289.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/asdfv1929/test.gita82933e..88ea401  add_commands -> add_commands

1.2.6 A推送报错

之后,A准备将本地代码push到远端库上时,就会报错,报错原因是远端包含了一些work但本地是没有的,其实就是用户B的最新提交和A本地的内容发生了冲突。

git push
To https://gitee.com/asdfv1929/test.git! [rejected]        add_commands -> add_commands (fetch first)
error: failed to push some refs to 'https://gitee.com/asdfv1929/test.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.

1.3 解决

报错原因是B提交了最新一次内容,但A是在B的上一次提交内容基础上进行修改的,所以此时A只需要将远端分支上最新的内容拉取下来,并将其与本地内容进行合并,最后重新push到远端服务器上即可。

git fetch giteegit merge gitee/add_commands      # 此时A处在add_commands分支上
Merge made by the 'ort' strategy.readme | 1 +1 file changed, 1 insertion(+)git push gitee
Enumerating objects: 9, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 6 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 555 bytes | 555.00 KiB/s, done.
Total 5 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/asdfv1929/test.git88ea401..5283e22  add_commands -> add_commands

远端库上,file1文件和readme文件的更新内容同时存在了。
在这里插入图片描述

二、场景2:不同人修改同文件的不同区域

2.1 场景描述

不同人修改了同一文件的不同区域。例如,用户A、B都对readme文件进行了修改,但修改的是文件中的不同区域部分

2.2 场景复现

2.2.1 B修改内容

用户B修改readme文件中间区域内的内容,并进行了commit提交。

vi readmeasdfv@DESKTOP-JWJ MINGW64 ~/Desktop/test (add_commands)
$ git commit -am 'userB edit'
[add_commands 0a9d613] userB edit1 file changed, 1 insertion(+), 1 deletion(-)

注意,此时B是未push到远端的状态!

2.2.2 A修改内容并推送

用户A也在修改readme文件的内容,但是在另一个区域部分,例如文件末尾;
commit完成后便push到服务端。

vi readme/g/test (add_commands)
git commit -am 'userA edit'
[add_commands 7fcd9b5] userA edit1 file changed, 2 insertions(+)/g/test (add_commands)
git push gitee
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 6 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 298 bytes | 298.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/asdfv1929/test.git5283e22..7fcd9b5  add_commands -> add_commands

2.2.3 B推送报错

此时,用户B将其本地的commit去push推送到远端时,就会发生报错。

git push
To https://gitee.com/asdfv1929/test.git! [rejected]        add_commands -> add_commands (fetch first)
error: failed to push some refs to 'https://gitee.com/asdfv1929/test.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.

2.3 解决

用户B只需再次将远端库代码拉取到本地,并进行合并,最后重新push到远端即可。

git fetch gitee
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 278 bytes | 8.00 KiB/s, done.
From https://gitee.com/asdfv1929/test5283e22..7fcd9b5  add_commands -> gitee/add_commands~/Desktop/test (add_commands)
git merge
Auto-merging readme
Merge made by the 'ort' strategy.readme | 2 ++1 file changed, 2 insertions(+)git push
Enumerating objects: 10, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 6 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 603 bytes | 603.00 KiB/s, done.
Total 6 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/asdfv1929/test.git7fcd9b5..2260cf2  add_commands -> add_commands

可以看到,用户A、B两人对同一文件readme的不同区域上的编辑内容都呈现出来了。
在这里插入图片描述

三、场景3:不同人修改同文件的同区域

3.1 场景描述

多个用户修改相同文件的相同区域。
例如,用户A和B都基于相同commit在做修改更新操作,且是对同一文件的相同区域做操作。

3.2 场景复现

3.2.1 用户A修改提交并推送

用户A修改readme文件后,进行commit之后便立即push了(先B一步推送)。

vi readme~/Desktop/test (add_commands)
git status
On branch add_commands
Your branch is up to date with 'gitee/add_commands'.Changes not staged for commit:(use "git add <file>..." to update what will be committed)(use "git restore <file>..." to discard changes in working directory)modified:   readmeno changes added to commit (use "git add" and/or "git commit -a")git commit -am 'userA edit readme'
[add_commands dd37a4d] userA edit same file same region1 file changed, 2 insertions(+)git push gitee
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 6 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 304 bytes | 304.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/asdfv1929/test.git2260cf2..dd37a4d  add_commands -> add_commands

3.2.2 用户B修改提交遇报错

用户B此时也在修改readme文件,且修改的区域与用户A相同,都是在文件的末尾。

vi readme/g/test (add_commands)
git commit -am"userB edit readme"
[add_commands 6b86e17] userB edit readme1 file changed, 1 insertion(+)

但此时用户B去push时,就会报错。

/g/test (add_commands)
git push gitee
To https://gitee.com/asdfv1929/test.git! [rejected]        add_commands -> add_commands (fetch first)
error: failed to push some refs to 'https://gitee.com/asdfv1929/test.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.

3.3 解决

遇到报错,那么用户B就需要先将远端库最新版本拉取下来,这边使用pull命令,但遇到告警:Automatic merge failed。这是Git在自动进行合并时发生冲突了,因为两用户都在同一文件的相同区域进行了编辑,Git就无法判断出做什么操作:是都保留、只保留A内容或者只保留B内容。这就需要用户来进行干预选择。

/g/test (add_commands)
git pull gitee
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 268 bytes | 11.00 KiB/s, done.
From https://gitee.com/asdfv1929/testa5658ce..4994050  add_commands -> gitee/add_commands
Auto-merging readme
CONFLICT (content): Merge conflict in readme
Automatic merge failed; fix conflicts and then commit the result.

此时去查看readme文件的内容:

/g/test (add_commands|MERGING)
cat readme
this is a test of pushsecond edit
hahhahahahaha
hahahahahah
userB edit readme between haha-content
content of add_commands branchsecond edit of user BuserA edit readme in the end.<<<<<<< HEAD
userB edit readme!!!
=======
userA edit readme!!!
>>>>>>> 4994050c587d0f11b63c5e06d2dcc7a481e6c88b

其中,<<<<<<< HEAD与"=======" 之间的内容表示为自己(用户B)的编辑内容,"======="和>>>>>>> 4994050c587d0f11b63c5e06d2dcc7a481e6c88b之间的内容为另一用户(用户A)的内容。

这边选择都保留,只需要把上面readme文件中的三处特殊标记删除并保存,最后提交commit和push即可。

vi readme
...
userB edit readme!!!
userA edit readme!!!/g/test (add_commands|MERGING)
git status
On branch add_commands
Your branch and 'gitee/add_commands' have diverged,
and have 1 and 1 different commits each, respectively.(use "git pull" to merge the remote branch into yours)You have unmerged paths.(fix conflicts and run "git commit")(use "git merge --abort" to abort the merge)Unmerged paths:(use "git add <file>..." to mark resolution)both modified:   readmeno changes added to commit (use "git add" and/or "git commit -a")/g/test (add_commands|MERGING)
git commit -am'resolve 2 users content'
[add_commands b6a3675] resolve 2 users content/g/test (add_commands)
git push
Enumerating objects: 10, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 6 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 548 bytes | 548.00 KiB/s, done.
Total 6 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/asdfv1929/test.git4994050..b6a3675  add_commands -> add_commands

在这里插入图片描述

四、场景4:同时变更文件名和内容

4.1 场景描述

多人同时变更了文件名称及其内容。

4.2 场景复现

4.2.1 用户A修改文件名

用户A对文件file1进行了重命名,并进行了commit,但尚未push。

git mv file1 file.txt~/Desktop/test (add_commands)
git status
On branch add_commands
Your branch is up to date with 'gitee/add_commands'.Changes to be committed:(use "git restore --staged <file>..." to unstage)renamed:    file1 -> file.txt~/Desktop/test (add_commands)
git commit -am'mv file1 file.txt'
[add_commands 1f27e65] mv file1 file.txt1 file changed, 0 insertions(+), 0 deletions(-)rename file1 => file.txt (100%)

4.2.2 用户B修改文件内容

用户B修改了同一文件file1的内容,且进行了commit。

/g/test (add_commands)
$ vi file1/g/test (add_commands)
git commit -am'userB add content in file1'
[add_commands 850703b] userB add content in file11 file changed, 2 insertions(+)

4.2.3 用户Apush到远端

用户A先一步进行了push,此时远端库发生了更新。

~/Desktop/test (add_commands)
git push gitee
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 6 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 279 bytes | 279.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/asdfv1929/test.gitb6a3675..1f27e65  add_commands -> add_commands

4.2.4 用户Bpush到远端报错

后面,用户B再去push时就会报错。

/g/test (add_commands)
git push gitee
To https://gitee.com/asdfv1929/test.git! [rejected]        add_commands -> add_commands (fetch first)
error: failed to push some refs to 'https://gitee.com/asdfv1929/test.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.

4.3 解决

此时就需要用户B重新将远端库上最新版本库pull拉取到本地,Git会自动将两处变动进行合并(A的重命名和B的添加内容),最后重新push即可。

/g/test (add_commands)
git pull gitee
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (2/2), 259 bytes | 18.00 KiB/s, done.
From https://gitee.com/asdfv1929/testb6a3675..1f27e65  add_commands -> gitee/add_commands
Merge made by the 'ort' strategy.file1 => file.txt | 01 file changed, 0 insertions(+), 0 deletions(-)rename file1 => file.txt (100%)/g/test (add_commands)
ls
file.txt  file2  readme/g/test (add_commands)
cat file.txt
user A edit file1userB edit file1!!!/g/test (add_commands)
git push
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 6 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 651 bytes | 651.00 KiB/s, done.
Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/asdfv1929/test.git1f27e65..06e4177  add_commands -> add_commands

五、场景5:多人把同一文件改成不同名称

5.1 场景描述

多个人把同一文件修改成不同的文件名称。

5.2 场景复现

5.2.1 用户A修改名称

用户A对file.txt文件进行了重命名,并提交了commit,但尚未push

~/Desktop/test/test (add_commands)
ls
file.txt  file2.txt  fileB.html  readme~/Desktop/test/test (add_commands)
git mv file.txt fileA.txt~/Desktop/test/test (add_commands)
git commit -am'userA mv file.txt fileA.txt'
[add_commands 3913944] userA mv file.txt fileA.txt1 file changed, 0 insertions(+), 0 deletions(-)rename file.txt => fileA.txt (100%)

5.2.2 用户B修改文件名

用户B对同一文件file.txt也修改了文件名,且命名不同,并最后push到了远端库上。

/g/test/test (add_commands)
git mv file.txt fileB.txt/g/test/test (add_commands)
git commit -am'userB mv file.txt fileB.txt'
[add_commands bda28ab] userB mv file.txt fileB.txt1 file changed, 0 insertions(+), 0 deletions(-)rename file.txt => fileB.txt (100%)/g/test/test (add_commands)
git push origin
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 6 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 233 bytes | 233.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/asdfv1929/test.git7801623..bda28ab  add_commands -> add_commands

5.2.3 用户Apush报错

此时用户A也去push时就会报错。

~/Desktop/test/test (add_commands)
git push origin
To https://gitee.com/asdfv1929/test.git! [rejected]        add_commands -> add_commands (fetch first)
error: failed to push some refs to 'https://gitee.com/asdfv1929/test.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.

5.3 解决

用户Apush遇到报错,这是因为本地库与远端库发生了冲突。
那正常情况下,都是先将远端库拉取到本地,并与本地内容进行合并,但此处会遇到冲突告警。

git pull origin
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (2/2), 213 bytes | 26.00 KiB/s, done.
From https://gitee.com/asdfv1929/test7801623..bda28ab  add_commands -> origin/add_commands
CONFLICT (rename/rename): file.txt renamed to fileA.txt in HEAD and to fileB.txt in bda28ab39ac039e39d1243290ee35bd8624a5e64.
Automatic merge failed; fix conflicts and then commit the result.

Automatic merge failed自动合并失败,这是因为Git无法判断该保留哪种重命名。
此时用户A和B需达成一致,并最终选择其一(人工干预)。

用户A这边查看一下git的状态,并选择最后的决定(选择哪个名字)。

~/Desktop/test/test (add_commands|MERGING)
git status
On branch add_commands
Your branch and 'origin/add_commands' have diverged,
and have 1 and 1 different commits each, respectively.(use "git pull" to merge the remote branch into yours)You have unmerged paths.(fix conflicts and run "git commit")(use "git merge --abort" to abort the merge)Unmerged paths:(use "git add/rm <file>..." as appropriate to mark resolution)both deleted:    file.txtadded by us:     fileA.txtadded by them:   fileB.txtno changes added to commit (use "git add" and/or "git commit -a")~/Desktop/test/test (add_commands|MERGING)   # 留意MERGING,表示处于合并中
git rm file.txt
rm 'file.txt'~/Desktop/test/test (add_commands|MERGING)
git add fileA.txt                           # 选择保留fileA.txt文件名,另外两种都删除~/Desktop/test/test (add_commands|MERGING)
git rm fileB.txt
rm 'fileB.txt'~/Desktop/test/test (add_commands|MERGING)
git status
On branch add_commands
Your branch and 'origin/add_commands' have diverged,
and have 1 and 1 different commits each, respectively.(use "git pull" to merge the remote branch into yours)All conflicts fixed but you are still merging.(use "git commit" to conclude merge)~/Desktop/test/test (add_commands|MERGING)
git commit -am'finally choose fileA.txt'         # 提交commit,并最终push到远端
[add_commands de4c6e5] finally choose fileA.txt~/Desktop/test/test (add_commands)
git push origin
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 6 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 364 bytes | 364.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/asdfv1929/test.gitbda28ab..de4c6e5  add_commands -> add_commands

用户B这边重新拉取,更新下文件名。

/g/test/test (add_commands)
git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 344 bytes | 43.00 KiB/s, done.
From https://gitee.com/asdfv1929/testbda28ab..de4c6e5  add_commands -> origin/add_commands
Updating bda28ab..de4c6e5
Fast-forwardfileB.txt => fileA.txt | 01 file changed, 0 insertions(+), 0 deletions(-)rename fileB.txt => fileA.txt (100%)/g/test/test (add_commands)
ls
file2.txt  fileA.txt  fileB.html  readme

六、总结

本文主要讲多人在单个分支上操作时常遇到的一些情形。在进行git操作时,对遇到的问题要多熟悉,能做到问题的快速定位,以及后续的及时解决。


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

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

相关文章

计算机网络概念、组成、功能和分类

文章目录 概要1.怎么学习计算机网络2.概念3.功能、组成4.工作方式、功能组成5.分类 概要 概念、组成、功能和分类 1.怎么学习计算机网络 2.概念 通信设备&#xff1a;比如路由器、路由器 线路&#xff1a;将系统和通信设备两者联系的介质之类的 计算机网络是互连的、自治的的计…

如何设计一个预约抢购活动

总体架构设计 互联网大量数据的存储设计 1&#xff09;哈希算法&#xff0c;对商品ID进行分片 节点取模的形式&#xff0c;优点是均匀分布&#xff0c;缺点是扩展性不好。所以&#xff0c;我们可以采用一致性hash。 一致性HASH的优点&#xff1a; 解决单一热点问题&#xf…

3060ti显卡+cuda12.1+win10编译安装生成fastdeploy的c++与python库

在cuda12中,调用官方发布的fastdeploy会出现报错,故此自行编译fastdeploy库。 官网编译教程:https://github.com/PaddlePaddle/FastDeploy/blob/develop/docs/cn/build_and_install/gpu.md 可选编译选项 编译选项 无论是在何平台编译,编译时仅根据需求修改如下选项,勿…

分布式springboot 3项目集成mybatis官方生成器开发记录

文章目录 说明实现思路实现步骤第一步&#xff1a;创建generator子模块第二步&#xff1a;引入相关maven插件和依赖第三步&#xff1a;编写生成器配置文件第四步&#xff1a;运行查看结果 说明 该文章为作者开发学习记录&#xff0c;方便以后复习和交流主要内容为&#xff1a;…

MGIE官网体验入口 苹果多模态大语言模型AI图像编辑工具在线使用地址

MGIE是一项由苹果开源的技术&#xff0c;利用多模态大型语言模型&#xff08;MLLMs&#xff09;生成图像编辑指令&#xff0c;通过端到端训练&#xff0c;捕捉视觉想象力并执行图像处理操作&#xff0c;使图像编辑更加智能、直观。 MGIE官网体验入口https://github.com/apple/M…

Mybatis- plus 基本使用

目录 一. 引入依赖 二.定义Mapper 三.常见注解 3.1TableName 3.2.TableId 3.3TableField 3.4常见配置 一. 引入依赖 由于这个starter包含对mybatis的自动装配&#xff0c;因此完全可以替换掉Mybatis的starter。 <dependency><groupId>com.baomidou</gr…

Python: pip install -e

pip install -e . 该命令会执行当前目录下的setup.py文件,将当前项目以editable mode安装&#xff1b; # pip 文档 https://pip.pypa.io/en/stable/cli/pip_install/ # Editable Install vs. Regular Install https://pip.pypa.io/en/stable/topics/local-project-install…

c++设计模式之代理模式

作用 代理模式主要用于&#xff0c;通过代理类&#xff0c;来控制实际对象的访问权限 案例 class VideoSite { public:virtual void freeVideo()0;virtual void vipVideo()0;virtual void trickVideo()0; };class FixBugVideoSite:public VideoSite { public:void freeVideo()…

【RT-DETR有效改进】计算训练好权重文件对应的FPS、推理每张图片的平均时间(科研必备)

👑欢迎大家订阅本专栏,一起学习RT-DETR👑 一、本文介绍 本文给大家带来的改进机制是利用我们训练好的权重文件计算FPS,同时打印每张图片所利用的平均时间,模型大小(以MB为单位),同时支持batch_size功能的选择,对于轻量化模型的读者来说,本文的内容对你一定有…

Unity引擎学习笔记之【动画层操作】

动画层Animation Layer 一、动画器的三个基本状态 1. Any State&#xff08;任意状态&#xff09; “Any State”&#xff08;任意状态&#xff09;&#xff1a;这个状态可以用来连接多个状态机的任意状态转换。在动画控制器中&#xff0c;你可以使用“Any State”作为过渡条…

Python基础语法(内置Python, pycharm配置方式)

一.工具安装与配置 1.Python解释器的安装 官网网址:https://www.python.org/ 选择downloads即可(Windows用户点击Windows, 苹果用户点击macOS) 找到最新版本, 并选择 Download Windows installer (64-bit) 下载完成后可在得到一个安装包进行安装(安装时间较长) 安装完成后…

NLP_“预训练+微调大模型”模式和Prompt/Instruct模式的异同

文章目录 “预训练微调大模型”的模式以提示/指令模式直接使用大模型“预训练微调大模型”模式和Prompt/Instruct模式的异同小结 “预训练微调大模型”的模式 经过预训练的大模型所习得的语义信息和所蕴含的语言知识&#xff0c;很容易向下游任务迁移。NLP应用人员可以根据自己…

Java中处理I/O操作的不同方式:BIO,NIO,AIO

Java中处理I/O操作的不同方式&#xff1a;BIO&#xff0c;NIO&#xff0c;AIO 亲爱的朋友&#xff0c; 在这美好的时刻&#xff0c;愿你感受到生活的温暖和欢乐。愿你的每一天都充满着笑容和满足&#xff0c;无论面对什么挑战都能勇往直前&#xff0c;化解困境。 希望你的心中充…

初识C语言·预处理详解

目录 1 预定义符号 2 define定义常量 3 #define定义宏 4 带有副作用的宏 5 宏替换的规则 6 宏和函数的对比 7 # 和 ## i) #运算符 ii) ##运算符 8 命名约定 9 命令行定义 10 条件编译 条件编译1&#xff1a; 条件编译2&#xff1a; 条件编译3&#xff1a; 条件…

昆仑万维发布天工 2.0 大语言模型及AI助手App;AI成功破解2000年前碳化古卷轴

&#x1f989; AI新闻 &#x1f680; 昆仑万维发布天工 2.0 大语言模型及AI助手App 摘要&#xff1a;昆仑万维近日推出了新版MoE大语言模型“天工 2.0”和相应的“天工 AI 智能助手”App&#xff0c;宣称为国内首个面向C端用户免费的基于MoE架构的千亿级参数大模型应用。天工…

UE4 C++创建摄像机摇臂和相机并且设置Transform

新建MyPawn C类 .h #include "GameFramework/SpringArmComponent.h" //SpringArm组件 #include "Camera/CameraComponent.h" //Camera组件class 工程名称_API AMyPawn : public APawn { //定义组件变量 public:UPROPERTY(VisibleAnywhere, BlueprintRead…

C#,字符串相似度的莱文斯坦距离(Levenshtein Distance)算法与源代码

一、莱文斯坦&#xff08;Levenshtein&#xff09; Vladimir I. Levenshtein 弗拉基米尔I列文施坦博士是纠错码理论的先驱&#xff0c;被称为俄罗斯编码理论之父。Levenshtein是莫斯科俄罗斯科学院Keldysh应用数学研究所的研究教授&#xff0c;他的贡献体现在消费者的日常生活中…

VBA技术资料MF116:测试操作系统是否为64位

我给VBA的定义&#xff1a;VBA是个人小型自动化处理的有效工具。利用好了&#xff0c;可以大大提高自己的工作效率&#xff0c;而且可以提高数据的准确度。我的教程一共九套&#xff0c;分为初级、中级、高级三大部分。是对VBA的系统讲解&#xff0c;从简单的入门&#xff0c;到…

洛谷P1039 [NOIP2003提高组]侦探推理

题目描述 明明同学最近迷上了侦探漫画《柯南》并沉醉于推理游戏之中&#xff0c;于是他召集了一群同学玩推理游戏。游戏的内容是这样的&#xff0c;明明的同学们先商量好由其中的一个人充当罪犯&#xff08;在明明不知情的情况下&#xff09;&#xff0c;明明的任务就是找出这…

使用SM4国密加密算法对Spring Boot项目数据库连接信息以及yaml文件配置属性进行加密配置(读取时自动解密)

一、前言 在业务系统开发过程中,我们必不可少的会使用数据库,在应用开发过程中,数据库连接信息往往都是以明文的方式配置到yaml配置文件中的,这样有密码泄露的风险,那么有没有什么方式可以避免呢?方案当然是有的,就是对数据库密码配置的时候进行加密,然后读取的时候再…