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

news2024/11/15 13:58:47

文章目录

  • 一、场景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 test

git 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_commands

git branch -av
* master                     73c6ad9 merge readme
  temp                       1395813 add readme
  remotes/gitee/add_commands 73c6ad9 merge readme
  remotes/gitee/master       73c6ad9 merge readme
  remotes/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 readme
 1 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.git
   73c6ad9..a82933e  add_commands -> add_commands

1.2.4 A修改与提交

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

git branch -av
* master                      73c6ad9 merge readme
  remotes/origin/HEAD         -> origin/master
  remotes/origin/add_commands a82933e add commands in readme
  remotes/origin/master       73c6ad9 merge readme
  remotes/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 file1

git 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 file1
 1 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 B
 1 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.git
   a82933e..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 gitee

git 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.git
   88ea401..5283e22  add_commands -> add_commands

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

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

2.1 场景描述

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

2.2 场景复现

2.2.1 B修改内容

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

vi readme

asdfv@DESKTOP-JWJ MINGW64 ~/Desktop/test (add_commands)
$ git commit -am 'userB edit'
[add_commands 0a9d613] userB edit
 1 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 edit
 1 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.git
   5283e22..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/test
   5283e22..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.git
   7fcd9b5..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:   readme

no 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 region
 1 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.git
   2260cf2..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 readme
 1 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/test
   a5658ce..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 push

second edit
hahhahahahaha
hahahahahah
userB edit readme between haha-content
content of add_commands branch
 second edit of user B

userA 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:   readme

no 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.git
   4994050..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.txt
 1 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 file1
 1 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.git
   b6a3675..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/test
   b6a3675..1f27e65  add_commands -> gitee/add_commands
Merge made by the 'ort' strategy.
 file1 => file.txt | 0
 1 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 file1

userB 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.git
   1f27e65..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.txt
 1 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.txt
 1 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.git
   7801623..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/test
   7801623..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.txt
        added by us:     fileA.txt
        added by them:   fileB.txt

no 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.git
   bda28ab..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/test
   bda28ab..de4c6e5  add_commands -> origin/add_commands
Updating bda28ab..de4c6e5
Fast-forward
 fileB.txt => fileA.txt | 0
 1 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.coloradmin.cn/o/1439733.html

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

相关文章

canvas实现涂鸦画板功能

查看专栏目录 canvas实例应用100专栏&#xff0c;提供canvas的基础知识&#xff0c;高级动画&#xff0c;相关应用扩展等信息。canvas作为html的一部分&#xff0c;是图像图标地图可视化的一个重要的基础&#xff0c;学好了canvas&#xff0c;在其他的一些应用上将会起到非常重…

HarmonyOS SDK 助力新浪新闻打造精致易用的新闻应用

原生智能是HarmonyOS NEXT的核心亮点之一&#xff0c;依托HarmonyOS SDK丰富全面的开放能力&#xff0c;开发者只需通过几行代码&#xff0c;即可快速实现AI功能。新浪新闻作为鸿蒙原生应用开发的先行者之一&#xff0c;从有声资讯入手&#xff0c;基于Speech Kit朗读控件上线听…

大模型为什么会有 tokens 限制?

人是以字数来计算文本长度&#xff0c;大语言模型 &#xff08;LLM&#xff09;是以 token 数来计算长度的。LLM 使用 token 把一个句子分解成若干部分。 token 可以是一个单词、一个单词中的一个部分、甚至是一个字符&#xff0c;具体取决于它使用的标记化方法 (tokenization…

基于麻雀优化算法优化XGBoost参数的优化控制策略

目录 一、背景 二、算法流程图 三、附录 一、背景 为提高极端梯度提升&#xff08;Extreme Gradient Boosting, XGBoost&#xff09;集成算法在时间预测、信贷风险预测、工件参数预测、故障诊断预测等方面中的准确性&#xff0c;研究者提出了一种改进的麻雀算法&#xff08;…

相机图像质量研究(7)常见问题总结:光学结构对成像的影响--镜片固化

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

07-OpenFeign-HTTP压缩优化

gzip是一种数据格式&#xff0c;采用用deflate算法压缩数据&#xff1b;gzip是一种流行的数据压缩算法&#xff0c;应用十分广泛&#xff0c;尤其是在Linux平台。 当GZIP压缩到一个纯文本数据时&#xff0c;效果是非常明显的&#xff0c;大约可以减少70&#xff05;以上的数据…

QTabWidget和QTabBar控件样式设置(qss)

QTabWidget和QTabBar控件样式设置 1、QTabWidget样式可自定义的有哪些示例&#xff1a;效果图 2、QTabBar样式可自定义的有哪些示例效果图 1、QTabWidget样式可自定义的有哪些 QTabWidget::pane{} 定义tabWidgetFrameQTabWidget::tab-bar{} 定义TabBar的位置QTabWidget::tab{}定…

【最详解】如何进行点云的凹凸缺陷检测(opene3D)(完成度80%)

文章目录 前言实现思路想法1想法2想法3 补充实现想法1想法2代码 想法3代码 总结 前言 读前须知&#xff1a; 首先我们得确保你已经完全知晓相关的基本的数学知识&#xff0c;其中包括用最小二乘法拟合曲二次曲面&#xff0c;以及曲面的曲率详细求解。若还是没弄清楚&#xff0…

《幻兽帕鲁》攻略:0基础入门及游戏基础操作 幻兽帕鲁基础设施 幻兽帕鲁基础攻击力 Mac苹果电脑玩幻兽帕鲁 幻兽帕鲁加班加点

今天就跟大家聊聊《幻兽帕鲁》攻略&#xff1a;0基础入门及游戏基础操作。 如果想在苹果电脑玩《幻兽帕鲁》记得安装CrossOver哦。 以下纯干货&#xff1a; CrossOver正版安装包&#xff08;免费试用&#xff09;&#xff1a;https://souurl.cn/Y1gDao 一、基础操作 二、界面…

稳压二极管应用电路

稳压二极管比较特殊&#xff0c;基本结构与普通二极管一样&#xff0c;也有一个PN结。由于制造工艺的不同&#xff0c;当这种PN结处于反向击穿状态时&#xff0c;PN结不会损坏(普通二极管的PN结是会损坏)&#xff0c;在稳压二极管用来稳定电压时就是利用它的这一击穿特性。 由…

【学网攻】 第(23)节 -- PPP协议

系列文章目录 目录 系列文章目录 文章目录 前言 一、PPP协议是什么&#xff1f; 二、实验 1.引入 实验目的 实验背景你是某公司的网络管理员&#xff0c;现在需要与另一个公司进行通信,需要你配置PPP协议保证双方发送的人是真正的而非黑客 技术原理 实验步骤新建Pack…

MySQL学习记录——유 表的约束

文章目录 1、了解2、空属性3、默认值default4、列描述comment就是注释&#xff0c;desc看不到&#xff0c;show能看到。5、zerofill6、主键7、自增长auto_increment8、唯一键9、外键 1、了解 只有数据类型的约束肯定不够&#xff0c;mysql还有表的约束来进而保证数据合法性。约…

安全名词解析-威胁情报、蜜罐技术

为方便您的阅读&#xff0c;可点击下方蓝色字体&#xff0c;进行跳转↓↓↓ 01 威胁情报02 蜜罐技术 01 威胁情报 威胁情报(Threat Intelligence)&#xff0c;也被称作安全情报(Security Intelligence)、安全威胁情报(Security Threat Intelligence)。 关于威胁情报的定义有很多…

redis的主从配置模拟(一主双从)

目录 先来给大家扩展机道面试官经常会问到关于redis的题 一、redis有哪些好处 二、redis相比memcached有哪些优势 三、redis常见性能问题和解决方案 四、redis集群的工作原理 五、redis主从的原理 redis的主从配置模拟&#xff08;一主双从&#xff09; 一、准备环境 …

C++ 内存管理(newdelete)

目录 本节目标 1. C/C内存分布 2. C语言中动态内存管理方式&#xff1a;malloc/calloc/realloc/free 3. C内存管理方式 3.1 new/delete操作内置类型 3.2 new和delete操作自定义类型 4. operator new与operator delete函数 5. new和delete的实现原理 6. 定位new表达式(placem…

Visio 2019下载安装教程,保姆级教程,附安装包

前言 Visio是负责绘制流程图和示意图的软件&#xff0c;便于IT和商务人员就复杂信息、系统和流程进行可视化处理、分析和交流&#xff0c;可以促进对系统和流程的了解&#xff0c;深入了解复杂信息并利用这些知识做出更好的业务决策。帮助您创建具有专业外观的图表&#xff0c…

Redis中内存淘汰算法实现

Redis中内存淘汰算法实现 Redis的maxmemory支持的内存淘汰机制使得其成为一种有效的缓存方案&#xff0c;成为memcached的有效替代方案。 当内存达到maxmemory后&#xff0c;Redis会按照maxmemory-policy启动淘汰策略。 Redis 3.0中已有淘汰机制&#xff1a; noevictionall…

【STL】list模拟实现

vector模拟实现 一、接口大框架函数声明速览二、结点类的模拟实现1、构造函数 三、迭代器类的模拟实现1、迭代器类存在的意义2、迭代器类的模板参数说明3、构造函数4、运算符的重载&#xff08;前置和后置&#xff09;&#xff08;1&#xff09;前置&#xff08;2&#xff09;后…

单片机学习笔记---LED点阵屏显示图形动画

目录 LED点阵屏显示图形 LED点阵屏显示动画 最后补充 上一节我们讲了点阵屏的工作原理&#xff0c;这节开始代码演示&#xff01; 前面我们已经说了74HC595模块也提供了8个LED&#xff0c;当我们不使用点阵屏的时候也可以单独使用74HC595&#xff0c;这8个LED可以用来测试7…

cpp11新特性之智能指针(下):深入理解现代cpp中的智能指针shared_ptr、unique_ptr 以及 weak_ptr

目录 写在前面 unique_ptr shared_ptr weak_ptr 智能指针的使用陷阱 致谢 写在前面 上一篇文章同大家深入探讨了auto_ptr。今天给大家带来的是对于 shared_ptr、unique_ptr 以及 weak_ptr 的深入理解&#xff0c;通过测试案例和源码剖析对这三种重要的智能指针的使用方法&…