1. 提交:首先,转到昨天建立的仓库文件夹里,然后我们创建一个gitCommit.txt文件,选择编辑文件,输入New File!2019/7/10 20:44(随便输入什么,我这个随便打的)。然后在GitBash里面,输入以下命令。回车之后,文件就已经上传至仓库了。
$ git add gitCommit.txt
$ git commit -m '新文件的提交'
2. 分支的创建:我们输入以下命令,这样我们就创建了一个分支dev。
$ git branch dev
接着执行以下命令查看所有的分支,回车之后会显示所有的分支。
$ git branch
然后执行以下命令切换到分支dev
$ git checkout dev
3. 分支的合并:分支的合并语句非常简单,首先将分支切换到master,然后执行以下命令。
$ git merge master
Auto-merging gitCommit.txt
CONFLICT (content): Merge conflict in gitCommit.txt
Automatic merge failed; fix conflicts and then commit the result.
这个时候,GitBash会提示出现冲突(我干的),然后看一下gitCommit.txt文件
New File! 2019/7/10 20:41
<<<<<<< HEAD
Branch Dev: New File! 2019/7/10 20:56
=======
Master: New File! 2019/7/10 20:57
>>>>>>> master
我们只需要删去<<<<<<<<<代码段A=========代码段B>>>>>>>>>>>>>我们只需要解决这中间的代码冲突就完事儿了。
接着执行以下命令。冲突解决!
$ git add gitCommit.txt
$ git commit -m 'OK'