#2: What are Git and Github? (Basic Stuff)

#2: What are Git and Github? (Basic Stuff)

Git and Github are the most used technologies in web development they are necessary for every developer to know about.

We will get a basic overview of what they are.

Let's begin!!!

1. What is Git?

  • Git is a version control system.
  • Version control system: It tracks and records the changes done by an individual or in a team this helps in maintaining a record of who did the change and when did the change happen.
  • So even if a person wants to change the code back to what it was they can do that thanks to Git.
  • It is locally installed on your machine.

2. Repository

  • In simple terms a folder that has all of your source code.
  • It is used to store all your files in one place.

There are mainly two types of repositories

  1. Local Repository: It's on your computer locally.
  2. Remote Repository: It is usually on a server so that a team can code on the same project at once.

3. Git commands

There are many git commands which do a specific task

Some of the most used ones are:

  • git config - specify username and email.
  • git init - create a new repository.
  • git status - track changes.
  • git clone - clone other's projects in your local machine.
  • git commit -m - save changes with a message.
  • git push - push the changes.

4. Commit

  • When changes are done to your code you commit it as in saving it.
  • A message is written with it called a commit message which specifies what the change is about.

5. Good commit messages

feat - A new feature added.
fix - fixing a bug.
docs - changes in documentation.
style - everything related to styling.
refactor - code changes that neither fix something nor create a feature.

6. Branching

  • It is sort of a timeline on which you work.
  • All the branches are saved so if you want to go back to an old version you can do that.
  • Finally, when you are done with experimenting and adding features to your work then it can be merged to the main branch or also called the master branch.

git-branches-merge.png

7. Github Desktop?

  • It can perform most of the Git commands but in the form of GUI (Graphical User Interface).
  • People who are new can use Github desktop as it is fairly simple to use.
  • But when you are working professionally Git is used.

8. What is Github?

  • It stores all your code on the cloud where people can see your code, use it, interact with it.
  • Github is a hosting service for projects that use Git.
  • It is basically an online version of Git.

9. Fork and Clone

Forking

  • Making a copy of someone else's repository remotely.

Cloning

  • Downloading a remote repository of someone else onto your computer.

10. Pull Request

  • When you have added a new feature to someone's project you send a pull request to the owner of the repository to check and review if all the changes are good to go and then your changes are merged to the main branch of the repository.

If you learned something new today why not connect with me?

Twitter Github Linkedin