标签:style http io ar os 使用 sp for 文件
第五题:clone代码 地址链接:
https://github.com/Gazler/cloneme.
LiGuicaideMacBook-Pro:git_hug Guicai$ git clone https://github.com/Gazler/cloneme Cloning into ‘cloneme‘... remote: Counting objects: 7, done. remote: Total 7 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (7/7), done. Checking connectivity... done. LiGuicaideMacBook-Pro:git_hug Guicai$ githug play ******************************************************************************** * Githug * ******************************************************************************** Congratulations, you have solved the level! Name: clone_to_folder Level: 6 Difficulty: * Clone the repository at https://github.com/Gazler/cloneme to `my_cloned_repo`.
第六题:clone代码 到my_cloned_repo
LiGuicaideMacBook-Pro:git_hug Guicai$ git clone https://github.com/Gazler/cloneme my_cloned_repo Cloning into ‘my_cloned_repo‘... remote: Counting objects: 7, done. remote: Total 7 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (7/7), done. Checking connectivity... done. LiGuicaideMacBook-Pro:git_hug Guicai$ githug play ******************************************************************************** * Githug * ******************************************************************************** Congratulations, you have solved the level! Name: ignore Level: 7 Difficulty: ** The text editor ‘vim‘ creates files ending in `.swp` (swap files) for all files that are currently open. We don‘t want them creeping into the repository. Make this repository ignore `.swp` files.
第七题:使用vim 修改.swp 不上传
githug hint查看了一下这道题的思路:
LiGuicaideMacBook-Pro:git_hug Guicai$ githug hint ******************************************************************************** * Githug * ******************************************************************************** You may have noticed there is a file named `.gitignore` in the repository.
看样子是修改.gitignore文件。
LiGuicaideMacBook-Pro:git_hug Guicai$ vi .gitignore
插入一行.swp
然后执行githug play 发现错误
我勒个去,忘记加*了,应该添加*.swp才对
LiGuicaideMacBook-Pro:git_hug Guicai$ githug hint ******************************************************************************** * Githug * ******************************************************************************** You may have noticed there is a file named `.gitignore` in the repository. LiGuicaideMacBook-Pro:git_hug Guicai$ ls -a .profile.yml . .git .profile.yml .. .gitignore README.swp LiGuicaideMacBook-Pro:git_hug Guicai$ vi .gitignore LiGuicaideMacBook-Pro:git_hug Guicai$ githug play ******************************************************************************** * Githug * ******************************************************************************** Sorry, this solution is not quite right! Name: ignore Level: 7 Difficulty: ** The text editor ‘vim‘ creates files ending in `.swp` (swap files) for all files that are currently open. We don‘t want them creeping into the repository. Make this repository ignore `.swp` files. LiGuicaideMacBook-Pro:git_hug Guicai$ githug hint ******************************************************************************** * Githug * ******************************************************************************** You may have noticed there is a file named `.gitignore` in the repository. LiGuicaideMacBook-Pro:git_hug Guicai$ vi .gitignore LiGuicaideMacBook-Pro:git_hug Guicai$ githug play ******************************************************************************** * Githug * ******************************************************************************** Congratulations, you have solved the level! Name: include Level: 8 Difficulty: ** Notice a few files with the ‘.a‘ extension. We want git to ignore all but the ‘lib.a‘ file.
第八题:忽略.a文件除了lib.a文件
修改.gitignore 添加两行代码
.profile.yml .gitignore *.a !lib.a
LiGuicaideMacBook-Pro:git_hug Guicai$ vi .gitignore LiGuicaideMacBook-Pro:git_hug Guicai$ githug play ******************************************************************************** * Githug * ******************************************************************************** Congratulations, you have solved the level! Name: status Level: 9 Difficulty: * There are some files in this repository, one of the files is untracked, which file is it?
第九题:查看状态 那个文件没有被跟踪
LiGuicaideMacBook-Pro:git_hug Guicai$ git status On branch master Initial commit Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: Guardfile new file: README new file: config.rb new file: deploy.rb new file: setup.rb Untracked files: (use "git add <file>..." to include in what will be committed) database.yml LiGuicaideMacBook-Pro:git_hug Guicai$ githug play ******************************************************************************** * Githug * ******************************************************************************** What is the full file name of the untracked file? database.yml Congratulations, you have solved the level! Name: number_of_files_committed Level: 10 Difficulty: * There are some files in this repository, how many of the files will be committed?
第十题:查看有多少条数据需要提交
LiGuicaideMacBook-Pro:git_hug Guicai$ githug hint ******************************************************************************** * Githug * ******************************************************************************** You are looking for a command to identify the status of the repository. LiGuicaideMacBook-Pro:git_hug Guicai$ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: rubyfile1.rb modified: rubyfile4.rb 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: rubyfile5.rb Untracked files: (use "git add <file>..." to include in what will be committed) rubyfile6.rb rubyfile7.rb LiGuicaideMacBook-Pro:git_hug Guicai$ githug play ******************************************************************************** * Githug * ******************************************************************************** How many changes are going to be committed? 2 Congratulations, you have solved the level! Name: rm Level: 11 Difficulty: ** 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.
第十一题:将已在工作区域删除的文件从repository中删除。
LiGuicaideMacBook-Pro:git_hug Guicai$ git status On branch master Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) deleted: deleteme.rb no changes added to commit (use "git add" and/or "git commit -a") LiGuicaideMacBook-Pro:git_hug Guicai$ git rm deleteme.rb rm ‘deleteme.rb‘ LiGuicaideMacBook-Pro:git_hug Guicai$ githug play ******************************************************************************** * Githug * ******************************************************************************** Congratulations, you have solved the level! Name: rm_cached Level: 12 Difficulty: ** A file has accidentally been added to your staging area, find out which file and remove it from the staging area. *NOTE* Do not remove the file from the file system, only from git.
第十二题:从git上移除刚才已提交的文件
LiGuicaideMacBook-Pro:git_hug Guicai$ git status On branch master Initial commit Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: deleteme.rb LiGuicaideMacBook-Pro:git_hug Guicai$ git rm deleteme.rb error: the following file has changes staged in the index: deleteme.rb (use --cached to keep the file, or -f to force removal) LiGuicaideMacBook-Pro:git_hug Guicai$ git rm --cached deleteme.rb rm ‘deleteme.rb‘ LiGuicaideMacBook-Pro:git_hug Guicai$ githug play ******************************************************************************** * Githug * ******************************************************************************** Congratulations, you have solved the level! Name: stash Level: 13 Difficulty: ** You‘ve made some changes and want to work on them later. You should save them, but don‘t commit them.
午睡啦~
标签:style http io ar os 使用 sp for 文件
原文地址:http://my.oschina.net/CgShare/blog/348144