Skip to content

Latest commit

 

History

History
59 lines (52 loc) · 3.39 KB

File metadata and controls

59 lines (52 loc) · 3.39 KB

Github Challenge

Instructions

You should spend 15 minutes on https://try.github.io/ and then answer the following quiz. You may also find https://learngitbranching.js.org to be fun and helpful to play around with before taking the quiz.

Your answer should be contained in a text file (not .doc) and look something like:

true
false
false
true
...

i.e. there should be one column, and either true or false for each question. Have fun!

Questions

  1. git is a version control system.
  2. You can create a git repository anywhere on your computer where you have write access.
  3. You create an empty git repo by writing git initiate in a terminal
  4. The new file octocat.txt being untracked means that git sees a new file in this repo.
  5. If you tell git to git add octocat.txt, the file will be saved to an online server.
  6. If you tell git to git commit -m 'cool message', it will save all files that you staged for commit with git add to an online server with the message cool message attached.
  7. If you tell git to git commit -m 'cool message', it will save all files that you staged for commit with git add to the repository on your computer with the message cool message attached.
  8. The command git remote add origin url associates to your repo an online server called origin, that can be reached at the url url
  9. If you type git push -u origin master you get the code from the online server called origin onto your computer.
  10. If you type git push -u origin master you send the changes added to the previous commits to the online server called origin.
  11. saying git pull origin master fetches the repo from origin and merges it into your local repo.
  12. After git pulling my collaborators' code from origin, git diff HEAD shows the difference between my last commit and the latest version on origin
  13. Octocat gets depressed when ocotodog becomes part of the octofamily.
  14. you can unstage a file, i.e. avoid it being included in your next commit by using the git reset command.
  15. In step 1.17, git reset delets octofamily/octodog.txt from your octofamily directory.
  16. creating branches allows you to work on several verions of your code before deciding which one to use eventually.
  17. You create a new branch called newbranch with the command git create branch newbranch
  18. You switch to a different branch with git switch branch
  19. Suppose you have file octocat.txt on the master branch and you go through the following sequence of commands:
    • git branch newbranch
    • git checkout newbranch
    • git rm octocat.txt
    • git commit -m 'removed octocat.txt' then the file octocat.txt has been removed from the master branch.
  20. Suppose you have file octocat.txt on the master branch and you go through the following sequence of commands:
    • git branch newbranch
    • git checkout newbranch
    • git rm octocat.txt
    • git commit -m 'removed octocat.txt'
    • git checkout master then the file octocat.txt has been removed from the master branch.
  21. Suppose you have file octocat.txt on the master branch and you go through the following sequence of commands:
    • git branch newbranch
    • git checkout newbranch
    • git rm octocat.txt
    • git commit -m 'removed octocat.txt'
    • git checkout master
    • git merge newbranch then the file octocat.txt has been removed from the master branch.