Git notes exercise

  • What is the difference between git and github?

Git is a version control system, it allows developers to keep track of their code’s history at any given point in time, by creating git repositories on each project. On the other hand, GitHub is cloub-based hosting service that allows developers to manage, organize and present all their repositories, it also permits collaboration and sharing on source code as part of a documentation.

  • What is the staging area?

The staging area is where GIT first starts tracking a given change, this is the stage that comes before actually commiting the change to the repository.

  • What does the -m switch do in git commit?

It allows to attach a comment or a message to a commit, this should describe the changes that have been committed.

  • What is the difference between merging and rebasing?

Merging will look for differences between the 2 branches and will create a new commit keeping the commit history intact, whilst rebasing will merge all changes to the main branch as a single patch, as a consequence of this, some of the commits might disappear as if they never existed.

  • What does git clone do?

It creates a copy of a repository in another directory, this clone stays in synch with the original, therefore any changes applied to the clone will be reflected on the original and vice versa.

  • What is forking?

Forking is the action of creating an exact copy of another repository but entirely disconnected from it, allowing the developer to experiment freely with the fork since it won’t have any repercussions on the forked repository.

  • How can we host a website on GitHub Pages?

By creating a repository and adding github.io at the end of the repository name, and of course having and html file in that repository

1 Like

1. What is the difference between git and github?

Git is a tool that lets you manage your source code history and GitHub is used to host services for Git repositories.

2. What is the staging area?

The staging area has changes that have not been committed yet.

3. What does the -m switch do in git commit?

It adds a message to the commit.

4. What is the difference between merging and rebasing?

Merging: integrates two or more different branches into one.
Rebasing: reapplies commits on top of another base branch.

The difference is that merging keeps the history as it happened and rebasing rewrites the history.

5. What does git clone do?

It is used to make a clone of an existing repository in a new directory

6. What is forking?

With forking, we can take a copy of another repository and make changes to the code without affecting the original project.

7. How can we host a website on GitHub Pages?

Create a new repository and change the name of the repository to your GitHub username. You can go to your hosted GitHub website by typing username.github.io in the search bar.

  • What is the difference between git and github?

GIT is a control system installed and maintained on local system. It’s a branching model.

GitHub it is a cloud-based hosting service. It is designed as a GIT repository hosting service and allows sharing code with others.

  • What is the staging area?

It is the place to record information before committing.

  • What does the -m switch do in git commit?

It switches and creates branches also, it restores files.

  • What is the difference between merging and rebasing?

Merging preserves history as it happened and Rebasing rewrites it.

  • What does git clone do?

It copies a repository into a newly created directory. It creates remote tracking branches for each branch in the cloned repository.

  • What is forking?

It is a Git clone operation executed in a server copy of projects repository. Forking keeps connection to the original repository.

  • How can we host a website on GitHub Pages?

1.Creating a repository 2.Push the code to the repository 3.Add html file 4. Add, Commit and push. Save changes 5.Fire up a browser and go to https:// username .github.io .

  1. Git keeps a record of versions of code and github host the repository for the uploaded code.

  2. The staging area is where changes will be before code is committed.

  3. It allows the user to add a message to the commit.

  4. A merge will merge 2 branches into one keeping both branches’ history. A rebase links the start of a branch to the end of a master branch.

  5. Creates a copy of a repository on your computer.

  6. Copying open source code, but changing it to suite your own needs.

  7. By making a repository and an html file with the username of the account

1. What is the difference between git and github?

Git is a version control system (VCS) that lets you manage and keep track of your source code history. Github is a cloud-based hosting service that lets you manage Git repositories.

2. What is the staging area?

It is a file in your git directory that stores information about what will go into your next commit.

3. What does the -m switch do in git commit?

The -m stands for message. When calling git commit, it is required to include a message to describe the changes being committed.

4. What is the difference between merging and rebasing?

Merging is a safe option that preserves the entire history of your repository, while rebasing creates a linear history by moving your feature branch onto the tip of main.

5. What does git clone do?

It creates an identical copy of a Git Remote Repository to the local machine.

6. What is forking?

Forking a repository is just to make a copy of it such that it allows you to freely experiment with the changes without affecting the original project.

7. How can we host a website on GitHub Pages?

Using GitHub's servers for free, you create a new repo with your github username and validation of your github account. Then copy the files you require to the new repo and push the changes.

What is the difference between git and github?
Git is a tool to create a local repository in our computers and manage our files. Github is an online service that can host our Git repositories in the cloud.

What is the staging area?
It’s where our modified files in our working trees are temporarily stored. This area is called the ‘index’.
We can revert back files that are in the index only but not in the working tree, to that of the last commit

What does the -m switch do in git commit?
Use the given as the commit message

What is the difference between merging and rebasing?
merging - Join two or more development histories together
rebase - reapply commits on top of another base tip - we can rewrite history

What does git clone do?
Clones a repository into a new directory

What is forking?
A copy of a Github repository. We can explore and make changes without affecting the upstream original repository.

How can we host a website on GitHub Pages?
One way is by forking a website project in an existent repository. We can then launch it by changing its link to: user_name.github.io

What is the difference between git and github?

  • Git is a version control system while Github is a hosting service utilizing Git repositories

What is the staging area?

  • contains the files that are going to be part of the next commit

What does the -m switch do in git commit?

  • lets you add a message and provide information about the commit

What is the difference between merging and rebasing?

  • Merging adds a new commit into a master branch and preserves the history while rebasing moves the base of feature branch to the endpoint of the master branch

What does git clone do?

  • Creates a copy of a target Git repository

What is forking?

  • Creates a copy of a target Git repository and allows one to freely experiment with changes without affecting the original project

How can we host a website on GitHub Pages?

  • Creating a public reposity conventionally named username.github.io where ‘username’ is your username on Github
  1. The main difference where versioning control takes place, for git - locally (only one person can change files that has access to computer), for github - online (when a few people can work on files simultaneously).

  2. Unlike the other systems, Git has something called the “staging area” or “index”. This is an intermediate area where commits can be formatted and reviewed before completing the commit. It’s possible to quickly stage some of your files and commit them without committing all of the other modified files in your working directory or having to list them on the command line during the commit.

  3. -m

--merge

If you have local modifications to one or more files that are different between the current branch and the branch to which you are switching, the command refuses to switch branches in order to preserve your modifications in context. However, with this option, a three-way merge between the current branch, your working tree contents, and the new branch is done, and you will be on the new branch.

  1. In merging you can create third branch from two parent branches that contain last commits on both parent branches.

Rebasing This operation works by going to the common ancestor of the two branches (the one you’re on and the one you’re rebasing onto), getting the diff introduced by each commit of the branch you’re on, saving those diffs to temporary files, resetting the current branch to the same commit as the branch you are rebasing onto, and finally applying each change in turn.

  1. git-clone - Clone a repository into a new directory

  2. A fork is a rough copy of a repository . Forking a repository allows you to freely test and debug with changes without affecting the original project. One of the excessive use of forking is to propose changes for bug fixing.

  • create repository - Head over to GitHub and create a new public repository named username .github.io, where username is your username (or organization name) on GitHub.

  • clone repository - on terminal go to the folder where you want to store your project, and clone the new repository: git clone https://github.com/ *username* / *username* .github.io

  • Enter the project folder and add an index.html file

cd username.github.io
echo "Name" > index.html

  • Add, commit, and push your changes:

git add --all

git commit -m "Initial commit"

git push -u origin main

  • Fire up a browser and go to https:// username .github.io .
  • What is the difference between git and github?
    Git tool creates a local repository of the project files. Github is a service that stores the git repositories in the cloud.

  • What is the staging area?
    It consists of files from the git directory that have changes to code, before the code is committed.

  • What does the -m switch do in git commit?
    Adds a message to the commit.

  • What is the difference between merging and rebasing?
    Merging is a saving method that preserves the entire history of the repository. Rebasing rewrites the history and doesn’t preserve it.

  • What does git clone do?
    Copies the git repository into a new directory.

  • What is forking?
    Creates a copy of a repository and allows us to make changes, without affecting the original project.

  • How can we host a website on GitHub Pages?
    Creating a repository and a HTML file with the accounts username.

  1. What is the difference between git and github?

Git is a version control system that helps to keep track your code and collaborate with team as we
develop.

github is a web interface for git. this is where we gonna store some of our repositories. It also let
us host websites.

  1. What is the staging area?

Staging area contains some changes that we would like to commit to the git repository. Whatever the
files are in the repository are gonna be stored and retrieveable. It also let us travel back to the
past using git

  1. What does the -m switch do in git commit?

-m switch allows you to pass in a new message from the command line without being prompted to open
an editor.

What is the difference between merging and rebasing?

Merging:

  • Its a non destructive operation, The existing branches are not changed in any way
  • Understanding the history is a bit difficult because both branches are active

Rebase:

  • It moves the entire feature branch on the tip of the main branch, incorporates all the new commits
    in main

  • Rebase gives us a much cleaner project history

  • Rewriting project history can be problematic for the collaboration workflow

  1. What does git clone do?

git clone is primarily used to point to an existing repo and make a clone or copy of that repo
at in a new directory, at another location. The git clone command copies an existing Git repository.

  1. What is forking?

A fork is a rough copy of a repository. Forking a repository allows you to freely test and debug
with changes without affecting the original project. One of the use of forking is to
propose changes for bug fixing.

  1. How can we host a website on GitHub Pages?
  • Create a repository
  • Clone the repository using git bash terminal to store your project
  • Enter the prject folder and add an index.html file
  • Add, Commit and push your changes
  • Fire up a browser and go to https://username.github.io.
1 Like
  1. Git is a version control application while github is an online platform that stores repositories.
  2. It’s the area where you can double check your code before committing it.
  3. Allows you to specify the commit message.
  4. Merging is uniting two branches into a single one. Rebasing is when you re-write a branch.
  5. Git clone makes a copy of the original.
  6. Taking a copy of a code and changing it to fit your own needs.
  7. By creating a repository
1 Like
  1. Git is a version-control system and Github is the cloud-based hosting service

  2. staging area labels the files that are going to be a part of next commit

  3. switch to the new branch, after resolves the conflicts between the current branch, working tree contents and the new branch

  4. merging retains the entire history of git repository

  5. make a copy of existing repo to another location

  6. it is a git clone operation executed on a server copy of a project repo

  7. add the website to git version controls, and then push the files to github

1 Like

1 What is the difference between git and github?

A: Git is a version control software. Github is a website which host git repos and share code

2: What is the staging area?

A: The staging area have files and changes that are going to commit.

3: What does the -m switch do in git commit?

A: With the -m switch you can add a comment to your commit.

4: What is the difference between merging and rebasing?

A: With merging a branch get created from the two last commits of 2 other branches. On the other hand, rebasing lets you commits or a sequence of them to a new commit in a linear way.

5: What does git clone do?

A: Copies a code that is in a branch.

6: What is forking?

A: Getting a copy from an original project that is made public. After changing the code of the fork it will not indicate the original one.

7: How can we host a website on GitHub Pages?

A: You can host a website on github by creating a repo with your username followed by .github.io

1 Like

After watching the video, answer the following questions:

    1. What is the difference between git and github?*
    1. What is the staging area?
    1. What does the -m switch do in git commit?
    1. What is the difference between merging and rebasing?
    1. What does git clone do?
    1. What is forking?
    1. How can we host a website on GitHub Pages?
    • Git is a distributed code management system for developing, tracking, and controlling changes. It allows to collaborate with other developers without breaking the code and work parallel with each other while being up to date with every change. GitHub is a code hosting platform for collaboration and version control managed by Git.
    • A Staging Area is a virtual place where the files or code are added by the programmer before committing them to the repository. In this place, you can store changes, remove them or add new one before the final step.
    • The -m switch stands for the message. It allows you to describe changes that you are committing. A message should be wrapped in quotations “message”
    • Merging preserves the history of both branches, and updates the latest commit of a side branch with all changes from the main branch. Merging is easier than rebasing. Rebasing updates the whole side branch ( every commit ) with the main branch changes and merges them. The commit history becomes linear and easier to track. Merging is preferable for large teams working on projects. Rebasing is preferable for a small team working on a project.
    • The git clone command is used to create a copy of a specific repository or branch within a repository and creates a local copy on your computer. By cloning with Git, you get the entire repository - all files, all branches, and all commits. It allows you to work with existing projects and contribute to them.
    • Forking is a process of copying existing code from GitHub repository with all existing history to your GitHub account.
    • Rename your GitHub repository with ending github.io
2 Likes

1.git is version control and github is a website for hosting git repositories
2. place where you store files before commiting them
3.it enables you to attach message to the commit
4. merging will keep all the branches rebasing will collapse everything into one master branch
5. clones a git repository to your pc
6. fork is also a cloning feature but it shows on your github also and has connection to the original repository
7. need to use your github username followed by .github.io (username.github.io)

1 Like
  • What is the difference between git and github?

Git is the version control on a local machine. GitHub hosts remote repositories of Git.

  • What is the staging area?

It is for sleceting the files for the next commit.

  • What does the -m switch do in git commit?

You can attach messages to a commit.

  • What is the difference between merging and rebasing?

merging pushes the changes of a branch to a master and rebasing also deletes said branch.

  • What does git clone do?

It clones a repository or a branch and gives you your own version of a repository to work with on your own.

  • What is forking?

A fork is a copy of an existing repository for testing purposes and without affecting the main version.

  • How can we host a website on GitHub Pages?

Your repository should be namend with the ending .github.io

1 Like
  • What is the difference between git and github?
    Git is version control, github is a hosting service for it
  • What is the staging area?
    The staging area is the sum of all added files before commiting
  • What does the -m switch do in git commit?
    Used to provide the commit description
  • What is the difference between merging and rebasing?
    Merging preserves branching history, rebasing brings all branches under one single timeline.
  • What does git clone do?
    Git clone makes a copy of a specified repository, linked to the original repository
  • What is forking?
    Similar to clone, but creates your own repository instead of linking to the original
  • How can we host a website on GitHub Pages?
    We can host a website on GitHub Pages by going to the repository settings -> pages, then choosing the branch and folder
1 Like

1:
Git used to track changes in your code and Github is used to display and show your code to others.
2:
A space where you can store your Git commits
3:
Lets you attach a message to your commit
4:
Merging is a safe option that preserves the entire history of your repository, while rebasing creates a linear history by moving your feature branch onto the tip of main . Git rebasing loses the other project’s commits.
5:
Creates a clone/copy of an existing repository into a new directory.
6:
A fork is a copy of a repository. Forking a repository allows to freely experiment with changes without affecting the original project.
7:
Pushing our project to get Github

1 Like
  1. Git = version control
    GitHub = hosting service for Git

  2. The area is the sum of all added files before commiting

  3. Provide the commit with a description

  4. Merging = preserves branching history
    Rebasing = brings all branches under one single timeline

  5. Makes a copy of a specific repository or branch with a repository & creates a local copy on your computer

  6. A of an existing repository for testing purposes & without affecting the main version.

  7. username.github.io

1 Like

What is the difference between git and github?
Git, is a control system for tracking changes in source code during development
GitHub, is a Git repository hosting service website

What is the staging area?
an area where commits can be formatted and reviewed before completing the commit

What does the -m switch do in git commit?
message, commit message

What is the difference between merging and rebasing?
Merge, will create a new merge commit to merge the master branch in the feature branch and connects histories of both branches.
Rebase, can move the entire feature branch to start on the tip of the master branch, and then rewrites the project history by creating new commits for each commit in the original branch

What does git clone do?
creates a copy of an existing repository into a new directory.

What is forking?
getting a copy of a repository to allow free experimentation of making code changes without affecting the original project.

How can we host a website on GitHub Pages?
sign up for an account, choose a plan, start a project or create a new repository, upload files, and use your github URL to share on the web.

1 Like