Git notes exercise

Exercise

After watching the video(s), answer the following questions, and post your answers below:

  1. What is the difference between git and github?
  2. What is the staging area?
  3. What does the -m switch do in git commit?
  4. What is the difference between merging and rebasing?
  5. What does git clone do?
  6. What is forking?
  7. How can we host a website on GitHub Pages?
What is the difference between git and github?

Git is the version control application, where github is an online platform that hosts git repositories.

What is the staging area?
  • A snapshot of files ready commit
  • If a staged file is modified after it its staged those changes are not “staged” and would need to be re-added to be included in the commit
What does the -m switch do in git commit?

Gives the ability to attach a message to the commit

What is the difference between merging and rebasing?

Bebasing replays the changes in on the side branch into the main branch in the order they occurred. The end result is the same, but the history is flattened into a line as if all the changes happened on the main branch.

What does git clone do?

Creates a copy of another repository at the current location.

What is forking?

Forking is creating a new project starting from a copy of another project. Changes pushed to the forked copy do not get added to the original. Both projects will continue separately from that point.

How can we host a website on GitHub Pages?

https://pages.github.com/

  1. Create a new repo with a name that combines your github username and “github.io
  2. Copy the website files to the new repo and push the changes
1 Like
  • What is the difference between git and github?

Git is the version controll that let`s you keep track of your code as you develope, saves your code if you mess up. Github is a cloud based server to serve your code to the web.

  • What is the staging area?

A space where you can store your git commits and retrieve them if needed.

  • What does the -m switch do in git commit?
    Let`s you attach a message to your commit for reference.

  • What is the difference between merging and rebasing?
    When you merge you add the commit to the master branch and only change the master branch. When rebasing you add the commit to the end of the master branch.

  • What does git clone do?
    It copies an excisting repository or code files to a new folder

  • What is forking?
    A fork is to copy a repository and change it without affecting the original source code. The difference between a fork and a clone is that the fork has a connection to the original depository.

  • How can we host a website on GitHub Pages?
    We can push our website to GitHub using version controll and also assign a custom domain.

1 Like

1. What is the difference between git and github?
[spoiler]Git is a version control system—essentially a tool to keep track of your source code; whereas, GitHub is a hosting service for Git repositories.[/spoiler]

2. What is the staging area?
[spoiler]The staging area is a standby area where you can look over your work before actually committing code to a repository.[/spoiler]

3. What does the -m switch do in git commit?
[spoiler]The “-m” switch allows you to type in a message regarding what you’re committing to the repository. The messages you type makes it easier for you or others to track changes made.[/spoiler]

4. What is the difference between merging and rebasing?
[spoiler]Merging keeps track of the history of all branches involved and is non-destructive; whereas, rebasing takes the feature branch and moves it to the end of the master branch. Rebasing can be destructive as it permits the user to alter the commit history.[/spoiler]

5. What does git clone do?
[spoiler]Git clone takes a snapshot of the repository and creates a second instance of it on the user’s local machine. This allows the user to modify the code without affecting the remote repository.[/spoiler]

6. What is forking?
[spoiler]Forking is similar to cloning; however, forking allows the user to make changes and submit a pull request to the repo owner to integrate on GitHub. If the user does not have write access to the forked repo, integrating is not possible.[/spoiler]

7. How can we host a website on GitHub Pages?
[spoiler]We can host a website on GitHub Pages by creating a repo with your username followed by .github.io[/spoiler]

.

  1. What is the difference between git and github?
    Git is a version control application. Github is a web service that store repositories.

  2. What is the staging area?
    It’s the files under version monitoring but not committed yet.

  3. What does the -m switch do in git commit?
    the -m in git commit allows to specify the commit message.

  4. What is the difference between merging and rebasing?
    Merging will incorporates the changes of the commits in the current branch. Rebasing will ‘transplantate’ a topic branch on another.

  5. What does git clone do?
    Git clone do a copy of a repository.

  6. What is forking?
    Forking allows to start a new project from a copy of a repo without connection (i.e. changes in the fork will not affect the original branch).

  7. How can we host a website on GitHub Pages?
    We can host a website on github creating a repository with a name following this pattern : https:// username .github.io and a file : index.html

What is the staging area?

Staging area is files which are going to be part of the next commit, this staging area let’s git understand what changes in the file going to occur for the next commit.

What does the -m switch do in git commit?

“-m” allows you to type a message to your commit for reference.

What is the difference between merging and rebasing?

Merging takes the contents of a source branch and integrates with the target branch. In this process only the target branch is changed. The source branch history remains the same. Rebasing compresses all the changes into a single “patch”. Then it integrates the patch onto the target branch. In this process unwanted history is eliminated.

What does git clone do?

The clone creates copy of an existing repository in a new directory locally on your machine.

What is forking?

A fork is a copy of the original repository(upstream repository) this repository stays on your github account.

How can we host a website on GitHub Pages?

Creating a repository -> push the code to the repository -> settings -> source choose master branch -> save changes -> press the url showing and enjoy your website!