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!
gitis a version control system.- You can create a git repository anywhere on your computer where you have write access.
- You create an empty git repo by writing
git initiatein a terminal - The new file octocat.txt being untracked means that git sees a new file in this repo.
- If you tell git to
git add octocat.txt, the file will be saved to an online server. - If you tell git to
git commit -m 'cool message', it will save all files that you staged for commit withgit addto an online server with the message cool message attached. - If you tell git to
git commit -m 'cool message', it will save all files that you staged for commit withgit addto the repository on your computer with the message cool message attached. - The command
git remote add origin urlassociates to your repo an online server calledorigin, that can be reached at the urlurl - If you type
git push -u origin masteryou get the code from the online server calledoriginonto your computer. - If you type
git push -u origin masteryou send the changesadded to the previouscommits to the online server calledorigin. - saying
git pull origin masterfetches the repo fromoriginand merges it into your local repo. - After
git pulling my collaborators' code fromorigin,git diff HEADshows the difference between my last commit and the latest version onorigin - Octocat gets depressed when ocotodog becomes part of the octofamily.
- you can unstage a file, i.e. avoid it being included in your next commit by using the
git resetcommand. - In step 1.17,
git resetdeletsoctofamily/octodog.txtfrom youroctofamilydirectory. - creating
branches allows you to work on several verions of your code before deciding which one to use eventually. - You create a new branch called
newbranchwith the commandgit create branch newbranch - You switch to a different branch with
git switch branch - Suppose you have file
octocat.txton themaster branchand you go through the following sequence of commands:git branch newbranchgit checkout newbranchgit rm octocat.txtgit commit -m 'removed octocat.txt'then the fileoctocat.txthas been removed from themasterbranch.
- Suppose you have file
octocat.txton themaster branchand you go through the following sequence of commands:git branch newbranchgit checkout newbranchgit rm octocat.txtgit commit -m 'removed octocat.txt'git checkout masterthen the fileoctocat.txthas been removed from themasterbranch.
- Suppose you have file
octocat.txton themaster branchand you go through the following sequence of commands:git branch newbranchgit checkout newbranchgit rm octocat.txtgit commit -m 'removed octocat.txt'git checkout mastergit merge newbranchthen the fileoctocat.txthas been removed from themasterbranch.