-----------------[Instruction]------------------ $ git status
-------------------[Prompt]-------------------- On branch master Changes not staged for commit: //修改了尚未提交的内容 (use "git add <file>..." to update what will be committed) //使用add添加要更新的内容 (use "git checkout -- <file>..." to discard changes in working directory) //使用checkout --放弃对文件的修改
modified: readme.txt //修改文件 readme.txt
no changes added to commit (use "git add" and/or "git commit -a") //没有为提交添加任何更改(使用“git添加”和/或“git commit -a”)
-------------------[Prompt]-------------------- diff --git a/readme.txt b/readme.txt index c2ed1e8..90f0f33 100644 --- a/readme.txt +++ b/readme.txt @@ -1 +1,3 @@ -Hello Word \ No newline at end of file +This This command is to update the file. +This is the second update. +This is the last update record. \ No newline at end of file
-------------------[Prompt]-------------------- 03b3138b888b688ea429ccd860c5e84a3db4efa2 The third test is on //这是-m 后面的更新提示,倒序展示 62c622fc4d32bd081a5f0ea80bc501b9a97c3079 add new readme aca27e458ca3aa8492778bca7ab125815ddbbd5e read a new file
-------------------[Prompt]-------------------- 03b3138 HEAD@{0}: reset: moving to 03b3138b888b688ea429ccd860c5e84a3db4efa2 62c622f HEAD@{1}: reset: moving to HEAD^ 03b3138 HEAD@{2}: commit: The third test is on 62c622f HEAD@{3}: commit: add new readme aca27e4 HEAD@{4}: commit (initial): read a new file
-----------------[Instruction]------------------ //创建一个文本文件,写点东西 $ vim LICENSE
-----------------[Instruction]------------------ //查看状态 $ git status
-------------------[Prompt]-------------------- On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory)
modified: readme.txt
Untracked files: (use "git add <file>..." to include in what will be committed)
LICENSE
no changes added to commit (use "git add" and/or "git commit -a")
此时提醒,readme的修改状态已经被管理检测到修改,但是没有添加到暂存区
而LICENSE则属于Untracked状态,从来没有被add添加过
B)执行两次add添加到暂存区 && 执行commit命令将暂存区内容上传到当前本地分支
1 2 3 4 5 6 7 8 9
-----------------[Instruction]------------------ $ git add readme.txt $ git add LICENSE $ git commit -m "The staging area to the workspace"
-------------------[Prompt]-------------------- [master 13853f9] The staging area to the workspace 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 LICENSE
-------------------[Prompt]-------------------- Auto-merging readme.txt CONFLICT (content): Merge conflict in readme.txt //提示readme.txt合并冲突 Automatic merge failed; fix conflicts and then commit the result. //自动合并失败;修复冲突,然后提交结果。
-----------------[Instruction]------------------ $ git status //使用查看状态来查看详细问题
-------------------[Prompt]-------------------- On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) 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.txt
no changes added to commit (use "git add" and/or "git commit -a")
-------------------[Prompt]-------------------- * ae51c0e 第二次合并 |\ | * 2a625ef add chongtu * | 59dea59 add Principal branch of conflict |/ * 13853f9 The staging area to the workspace * 03b3138 The third test is on * 62c622f add new readme * aca27e4 read a new file
$ git merge --no-ff -m "merge with no-ff" dev03 //合并分支 $ git log --graph --pretty=oneline --abbrev-commit //查看分支详细流程日志 -------------------[Prompt]-------------------- * c7562a6 merge with no-ff |\ | * 1a027fc add merge 2 |/ * ae51c0e 第二次合并 |\ | * 2a625ef add chongtu * | 59dea59 add Principal branch of conflict |/ * 13853f9 The staging area to the workspace * 03b3138 The third test is on * 62c622f add new readme * aca27e4 read a new file