关于提供的githug攻略中的说明 以及 练习时的记录

关于上一篇 演示ruby的安装、下载githug游戏 中提供的简书博主的攻略,
存在一些瑕疵,特此提供说明。

常用命令

githug: 开始闯关或进入下一关
githug hint: 过关提示
githug levels: 显示关卡列表
githug reset [关卡名]: 重启本关或者重启到指定关卡名的关卡

第十关

There are some files in this repository, how many of the files will be committed?
	这个库中有一些文件,将提交多少个文件?

博主只提供了 git status 查看状态,然而查看后还需要回答:
How many changes are going to be committed?
	要进行多少修改

我们可以看到暂存区中有两个绿色文件名,我们只需要输入 2 即可完成本关。

第十关

第十一关

A file has been removed from the working tree, however the file was not
removed from the repository. Find out what this file was and remove it.
	有一个文件被从工作目录中直接删除了,而没有通知到仓库,
	找到这个文件,把它从仓库中删除。 

首先查看状态 git status, 然后再进行删除操作(也可以进行添加)。

在这里插入图片描述
在这里插入图片描述

第二十五关

The remote repositories have a url associated to them. 
Please enter the url of remote_location.
	这个远程仓库有一个与它相关的 URL,请输入远程仓库 remote_location 的 URL 地址。

查询远程仓库的url:git remote -v
输入url即可过关。

在这里插入图片描述

第三十一关

You want to work on a piece of code that has the potential to break things, 
create the branch test_code.
	你想要修改一处代码,在修改过程中可能会引起一些问题,
	所以要创建一个分支 test_code 来修改。

查看分支:git branch
创建名为test_code的分支:git branch test_code

在这里插入图片描述

第三十二关

Create and switch to a new branch called my_branch. 
You will need to create a branch like you did in the previous level.
创建并切换到新分支 my_branch。你要像上一关那样先创建一个分支。

切换到指定目录:git checkout branch-name
创建并切换到这个目录:git checkout -b branch-name
切换到上次所在的目录:git checkout -

在这里插入图片描述

第三十三关

You need to fix a bug in the version 1.2 of your app. 
	Checkout the tag v1.2.
你要在 1.2 版本中修复一个 bug,切换到 tag 'v1.2'。

切换到指定标签tag中:git checkout v1.2

第17关、第32关、第33关这三关的命令形式都一样,只有参数的含义不同,
一个是文件名,一个是分支名,一个是标签名。

在这里插入图片描述

第三十四关

You need to fix a bug in the version 1.2 of your app. Checkout the tag v1.2 
(Note: There is also a branch named v1.2).
	你要在 1.2 版本中修复一个 bug,切换到 tag 'v1.2'
	(注意:现在有一个分支也叫 'v1.2')。

我们在切换时需要明确指定时tag的v1.2:git checkout tags/v1.2

在这里插入图片描述

第三十五关

You forgot to branch at the previous commit and made a commit on top of it. 
Create branch test_branch at the commit before the last.
	你忘记了在上一个提交之间先创建一个分支就提交了。
	创建一个分支 test_branch 在最后一次提交之前。

git branch test_branch HEAD~1
	最后一个参数表示在上次提交之前

在这里插入图片描述

发布了179 篇原创文章 · 获赞 20 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/ExclusiveName/article/details/104862848