【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.hqwc.cn/news/459910.html

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

相关文章

代码随想录算法训练营第30天| 51. N皇后、总结

51. N皇后 完成 思路&#xff1a; 如何用回溯法搜索二维棋盘是这道题目和之前不一样的地方&#xff0c;也是题目的难点。 在树形结构中&#xff0c;同层取同一行棋盘的不同列遍历。每递归一次就往下遍历一行。 代码 class Solution {List<List<String>> res n…

Pytorch+NCCL源码编译

目录 环境1. 安装cudnn2. 使用pytorch自带NCCL库进行编译3. 修改NCCL源代码并重新编译后测试&#xff0c;体现出源码更改 环境 Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-91-generic x86_64)cuda 11.8 cudnn 8python 3.10torch V2.0.1 nccl 2.14.3NVIDIA GeForce RTX 4090 *2 1.…

疑似针对安全研究人员的窃密与勒索

前言 笔者在某国外开源样本沙箱平台闲逛的时候&#xff0c;发现了一个有趣的样本&#xff0c;该样本伪装成安全研究人员经常使用的某个渗透测试工具的破解版压缩包&#xff0c;对安全研究人员进行窃密与勒索双重攻击&#xff0c;这种双重攻击的方式也是勒索病毒黑客组织常用的…

python入门篇11-面向对象的基础使用

全文目录,一步到位 1.前言简介1.1 专栏传送门1.1.1 上文小总结1.1.2 上文传送门 2. python基础使用2.1 面向对象的基础使用2.1.1 创建类2.1.2 使用对象(定义成员变量)2.1.3 成员方法的定义与使用2.1.4 构造方法的使用2.1.5 常用魔术方法 2.2 面向对象思想核心2.2.1 面向对象_私…

【知识整理】管理即服务,识人、识己

1. 背景 一个人的力量是有限的&#xff0c;如何规模化生产&#xff0c;人员的规模化组织&#xff0c;如何提升合作的规模和效率。 管理的本质&#xff1a; 1、服务他人&#xff1f; 2、激发主动性&#xff1f; 3、氛围宽松&#xff1f; 上面是理念&#xff0c; 1、那如何…

006集——where语句进行属性筛选——arcgis

在arcgis中&#xff0c; dBASE 文件除了 WHERE 语句以外&#xff0c;不支持 其它 SQL 命令。选择窗口如下&#xff1a; 首先&#xff0c;我们了解下什么是where语句。 WHERE语句是SQL语言中使用频率很高的一种语句。它的作用是从数据库表中选择一些特定的记录行来进行操作。WHE…

Spring Cloud使用ZooKeeper作为注册中心的示例

简单的Spring Cloud应用程序使用ZooKeeper作为注册中心的示例&#xff1a; 1.新建模块&#xff1a; 2.勾选依赖&#xff1a; 3.在pom.xml文件中做出部分修改及添加Spring Cloud Zookeeper 依赖版本&#xff1a; 完整pom文件 <?xml version"1.0" encoding&q…

LoveWall v2.0Pro社区型校园表白墙源码

校园表白墙&#xff0c;一个接近于社区类型的表白墙&#xff0c;LoveWall。 源码特色&#xff1b; 点赞&#xff0c; 发评论&#xff0c; 发弹幕&#xff0c; 多校区&#xff0c; 分享页&#xff0c; 涉及违禁物等名词进行检测&#xff01; 安装教程: 环境要求&#xff1b;…

Vue中v-on 可以监听多个方法吗

当然可以&#xff01;Vue.js是一款非常强大的JavaScript库&#xff0c;它提供了很多方便的方法和指令&#xff0c;使我们可以更容易地构建交互式的Web应用程序。其中&#xff0c;v-on指令是Vue.js中一个非常重要也非常常用的指令&#xff0c;它用于监听DOM事件&#xff0c;并在…

vite项目配置根据不同的打包环境使用不同的请求路径VITE_BASE_URL,包括报错解决

vite环境配置可以看官方文档&#xff1a;环境变量和模式 | Vite 官方中文文档 创建环境配置文件 在项目根目录下面创建.env和.env.production文件&#xff0c;.env是开发环境使用的&#xff0c;.env.production是生产环境使用的。 .env文件&#xff1a; # 基本环境 VITE_APP…

【PyQt】06-.ui文件转.py文件

文章目录 前言方法一、基本脚本查看自己的uic安装目录 方法二、添加到扩展工具里面&#xff08;失败了&#xff09;方法二的成功步骤总结 前言 方法一、基本脚本 将Qt Designer&#xff08;一种图形用户界面设计工具&#xff09;生成的.ui文件转换为Python代码的脚本。 pytho…

搭建macOS开发环境-1:准备工作

请记住&#xff1a; 最重要的准备工作永远是&#xff1a;备份数据 !!! 通过图形界面检查 Mac 的 CPU 类型&#xff1a; 在搭载 Apple 芯片的 Mac 电脑上&#xff0c;“关于本机”会显示一个标有“芯片”的项目并跟有相应芯片的名称&#xff1a; 通过命令行检查Mac的CPU类型 …