關於提供的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
	最後一個參數表示在上次提交之前

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章