Git notes exercise

1 Git is a version control system 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 The staging area is like a rough draft space, it’s where you can git add the version of a file or multiple files that you want to save in your next commit.

3 This let`s you attach a message to your commit for reference.

4 Rebasing 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.

5 Git clone creates a copy of another repository at the current location.

6 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.

7 -Create a new repo with a name that combines your github username and “github.io
-Copy the website files to the new repo and push the changes

1 Like
  1. Git is a decentralized source management control system so we can track our changes as we develop. Github is a website that hosts git repositories so developers can collaborate on what they’re working on.
  2. The staging area is where we can see our changes that we would like to commit into our git repo.
  3. The -m switch allows you to add a commit message.
  4. Merging is when you have two branches and create a third commit that has two parents (the history is not fully linear). With rebasing, you can fully read a linear history, and you have a clear order of sequence of the commits, when you do rebase you change the history of the branch(es).
  5. Git clone copies another repository so that someone else would be able to edit it or you could edit someone else’s repo.
  6. Forking is taking basically a copy of a github repository and hosting it under our name. With forking you will get all of the files and full commit history of the original repository.
  7. We can make a git repository under our username and write [username].github.io for the repository name.

Exercise

After watching the video, answer the following questions:

  • What is the difference between git and github?
    git is for keeping track of code changes
    github is a site for this, and where people can show and look at code
  • What is the staging area?
    a place where you can put in code, and you can make a commit with it later
  • What does the -m switch do in git commit?
    commit message
  • What is the difference between merging and rebasing?
    merge adds commits to your branch
    rebasing joins branches
  • What does git clone do?
    clone / copy
  • What is forking?
    making another version of a piece of code. for crypto, dividing a crypto network, to make a new type of crypto (like Bitcoin Cash)
  • How can we host a website on GitHub Pages?
    name.github.io
1 Like
  1. What is the difference between git and github?

Git is a decentralised source control system, github is a cloud based hosting service that helps with managing git repositories.

    • What is the staging area?

The staging area is where you put all the code you want to commit at a later time.

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

-m stands for message, it allows you to write a description with your commit.

    • What is the difference between merging and rebasing?

Merging is when you merge branches together whilst resolving all conflicts at once, the down side to this is that it is unorganised.

Rebasing is when you merge branches but you manually resolve each conflict resulting in a cleaner commit tree and gives more readable information. You can also change the history of your commits by placing a more recent commit before an older commit.

    • What does git clone do?

git clone is used to make a copy of a chosen repository and saved at another location. Its also linked to the original project and will continue to synchronize with the original repository.

    • What is forking?

Forking is when you create a copy of a repository that is independent of its origins meaning you no longer synchronise with the original repository when committing and both projects will be developed separately.

    • How can we host a website on GitHub Pages?

We can push a website to GitHub using git commits followed by assigning a custom domain name that has your username with github in it. (username.github.io)

1 Like
  1. Git is a distributed version control system (which means it can be cloned as a fully functional local repository, where you can work remote or offline while syncing copies of the repository to copies on the server, and track changes through development stages); GitHub is a hosting platform for Git that allows developers to store projects for version control and collaboration in development.

  2. The staging area is a rough draft space where versions of the files can be saved before being committed.

  3. The -m switch is used in an inline command to tell Git which committed version the changes should be applied to.

  4. Merging combines commits on separate branches into the current branch, while the target branch remains unaffected.

  5. Git clone will copy an existing Git repository into a newly created directory, creating remote-tracking branches for each branch in the cloned repository.

  6. Forking is creating a copy of a complete repository to the user’s GitHub Account from another account, allowing changes to be made that aren’t pushed to the original.

  7. Create a repository, then go to the Settings and and change name to “username.github.io ” - if it is available then you can host the website on GitHub.

1 Like
  1. Git is a version control system whereas Github is a hosting service to for Git repositories.
  2. The staging area is where you can look at your code before you commit the code to your repo.
  3. -m allows you to write messages on what changes you have made to your code.
  4. Merging keeps track of the history of the branches. Rebasing takes the feature branch and moves it to the master branch. Merging is non-destructive and Rebasing can be destructive.
  5. Git clone clones the repository
    6.Forking and Cloning are both very similar, but with Forking, you can make changes and submit a pull request.
  6. Create a repo with your username followed by .github.io.

1. What is the difference between git and github?

  • Git is a version control application, a tool widely used to maintain track of every step of the code while GitHub is a web service where you can host your Git repository.

2. What is the staging area?

  • The staging area is a “standby” area where you can manage what of your work was added (and what was not) before committing the changes to the code repository.

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

  • The ‘-m’ stands for ‘message’ and has the purpose of facilitating the identification of every commit that was previously created. In other words, the message associated with every commit makes it easier to track all the changes you’ve done through time.

4. What is the difference between merging and rebasing?

  • Merging is when you unify two branches (mainly a branch of a feature you were working on to the MASTER branch) in a way that it becomes one (The branch that remains is the MAIN or MASTER one). The source history remains as it was.
  • On the other side, rebasing takes the feature branch and moves it to the end of the master branch. Rebasing may ‘destroy’ or ‘change’ the commit history, depending on how the user does it.

5. What does git clone do?

  • git clone creates a copy of a remote repository into your machine on a local directory. It allows you to work on someone else’s code without changing the original code itself.

6. What is forking?

  • Forking is the method of ‘cloning’ a public Git Repository, creating a new repository on your own GitHub account. Any changes you make this code won’t affect the original repository unless you submit a pull request to the repository owner, but you won’t be able to do that if you don’t have this privilege (write access), which may be granted by the original repository owner.

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

  • You may host a page on GitHub Pages when you create the repository containing the .html file (index.html) and allowing the GitHub to have access to your main branch on the configuration (Settings / Pages…). Once you’re on that part, you have to select the source (which is the ‘main’ branch) and, then, the GitHub will deploy your website.

Hi All :grinning:

  1. What is the difference between git and github?
  • git is a source control system accessible from a command line
  • GitHub is a website giving a nice user interface on top of git and additional collaboration possibilities.
  1. What is the staging area?

This is were you store the files that you intend to commit to the repository.

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

Adds a comment to a commit.

  1. What is the difference between merging and rebasing?

Merging consists in bringing the changes made to a branch (for instance feature-branch) into another branch (for instance master). In the case of a fast forward merge, the operation is straightforward and only consists in moving the master branch to the latest commit of feature-branch.

Rebasing changes the common ancestor of two branches by syncing the current branch with the changes from the other branch. For example if changes were done in parallel on two separate branches, rebasing one branch brings in the changes from the other branch. Then all is needed is a fast-forward merge to make both changes look like they were done in sequence instead of in parallel.

  1. What does git clone do?

Creates a local copy of a GitHub repository.

  1. What is forking?

Forking creates a repository in your GitHub account as a copy of an existing project found in another GitHub account.

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

Use the settings pages to change the repository name to [your username].github.io

*Git is a source control system which you can access from a command line such as bash.

  • GitHub is a website that enables people to collaborate on git repositories and enables the storage of development projects for version control.
  1. The staging area is where files are saved before they are committed.

  2. The -m command allows you to include a message with your commit

  3. Rebasing replicates the modifications that occurred on the minor branch into the main line in the sequence they happened. The final outcome is the same, but the past has been squashed into a single segment as if all changes occurred on the main branch.

  4. Git clone makes a duplicate of a current repository in a new directory.

  5. A fork is a duplicate of a repository that already exists and is used for testing without changing the primary version.

  6. Use your github login, then add.github.io to the end of the URL. (username.github.io)