Administrator@USER-20200307HH MINGW64 /f/Git (master)
$ git branch
* master
Administrator@USER-20200307HH MINGW64 /f/Git (master)
$ git checkout -b dev
Switched to a new branch 'dev'
Administrator@USER-20200307HH MINGW64 /f/Git (dev)
$ git add box.txt------------------------------------------------------》内容是“”quick AND simple“”
Administrator@USER-20200307HH MINGW64 /f/Git (dev)
$ git commit -m"branchtest"
[dev 00330dd] branchtest
2 files changed, 2 insertions(+)
create mode 100644 box.txt
create mode 160000 test
Administrator@USER-20200307HH MINGW64 /f/Git (dev)
$ git switch master
warning: unable to rmdir 'test': Directory not empty
Switched to branch 'master'
Your branch is up to date with 'origin/master'. 文件情况如下:工作区里面有一个test文件夹,不能被删,因为不是空文件夹
Administrator@USER-20200307HH MINGW64 /f/Git (master)
$ git switch dev
Switched to branch 'dev'------------------------------------------------------------------》现在切到dev,这个box.txt又回来了
Administrator@USER-20200307HH MINGW64 /f/Git (dev)
$ git switch master--------------------------------------------------------------------------》又切换回master,box.txt又不见了
warning: unable to rmdir 'test': Directory not empty
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
然后我莫名的删了一个测试建的远程库:
Administrator@USER-20200307HH MINGW64 /f/Git (master)
$ git remote rm origin
Administrator@USER-20200307HH MINGW64 /f/Git (master)
$ git remote-------------------------------------------------------------------------------------》unix的哲学,没有消息就是最好的消息
Administrator@USER-20200307HH MINGW64 /f/Git (master)
$ git push origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Administrator@USER-20200307HH MINGW64 /f/Git (master)
$ git switch dev
Switched to branch 'dev'.................................结果如下:
所以结论是在哪个分支就只看得到当前分支及其之前提交点的文件问题一解决!
我们这个实验是解决标题所示的问题2的,所以如下继续:
所以如上,我切换之后master上边没有box,我修改个xx???
所以现在电脑说的话我懂了
Administrator@USER-20200307HH MINGW64 /f/Git (dev)
$ git switch master
warning: unable to rmdir 'test': Directory not empty-----------------------------------------------------------------------------------》即:每次切换的时候,是把当前分支文件夹删除??!!!
Switched to branch 'master'
那我就从了你吧我干了这件事:
Administrator@USER-20200307HH MINGW64 /f/Git (master)
$ rm -rf test
master下面test文件夹确实没有在了
但是我又回来
Administrator@USER-20200307HH MINGW64 /f/Git (master)
$ git switch dev
Switched to branch 'dev'发现如下:
test在dev分支下又出现了!!!!而且里面变空了:
现在切回master,他也不bibi什么test没法删了。但box.txt还是没有(那我完成个xx的问题2???!!!)
所以调转方向:删除以上所有操作,并在master里面建设bbb.txt。去新建的分支里面更改冲突
Administrator@USER-20200307HH MINGW64 /f/Git (master)
$ git switch -c dev1
Switched to a new branch 'dev1'
这下里面还是有bbb了:(但这是建立在我没有在master上gitadd和git commit基础上的)
果不其然我回master一趟一气呵成(commit)之后,再回来,bbb.txt又不见了
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。放弃了
Hold on!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
画一画图
我们或许不像教程上那样
但我们可以在 1.先创建一个dev1分支
2.在master上我们创建bbb.txt文件
3.因为master跑得快所以切换到新建分支并git merge master
这样两个分支都有了,自己画一下图
现在就可以更改提交dev1上的bbb了(改为小写and)
并在master上改为&并提交
现在想要merge两个分叉分支:
Administrator@USER-20200307HH MINGW64 /f/Git (master)
$ git merge dev1 ---------------------------------------------------------------------》合并指定分支到当前位置
Auto-merging bbb.txt
CONFLICT (content): Merge conflict in bbb.txt
Automatic merge failed; fix conflicts and then commit the result.--------------------------------------------------〉想要的冲突出现
现在情况如图:
我知道把master的改成AND HUOZHE and 冲突会消失
但我想知道的是问题二(一个&的原因???)
所以我把dev1上修改提交为AND
Administrator@USER-20200307HH MINGW64 /f/Git (master|MERGING) $ git switch dev1 fatal: cannot switch branch while merging Consider "git merge --quit" or "git worktree add".
(才发现可以这样搞)
所以我退出,我退出
但是还是没法
Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git switch dev1 error: you need to resolve your current index first bbb.txt: needs merge
所以我又回到最初的起点
只有办法进行改正master的&
但一打开文件。。。。。。
修改如图并提交
结果
Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git merge dev1 Auto-merging bbb.txt CONFLICT (content): Merge conflict in bbb.txt Automatic merge failed; fix conflicts and then commit the result.
现在情况如图
所以我只有把AND 改为and了并提交(教程到底怎么回事啊!!!!!!!!!!)
再来
Administrator@USER-20200307HH MINGW64 /f/Git (master)
$ git merge dev1
Already up to date.
。。。。。。。。。。所以必须长一样吗?怎么和教程不一样??
不过,我学会了在博客里面插入代码比较美观
2020/5/6学了羌笛那天。开学遥遥无期