Chat Zalo Chat Messenger Phone Number Đăng nhập
What is Git and Why Should You Use it? - Noble Desktop

What is Git and Why Should You Use it? – Noble Desktop

What is Git?

Git is the most widely used version control system. Git keeps track of the changes you make to files, so you have a record of what’s been done and can revert to specific versions if you ever need to. Git also facilitates collaboration, allowing changes from multiple people to be merged into a single source.

So regardless of whether you write code that only you will see or work as part of a team, Git will be useful for you


git branches merge

Git is software that runs locally. Your files and history are stored on your computer. You can also use online hosts (such as GitHub or Bitbucket) to store a copy of your files and your revision history. Having a central location where you can upload your changes and download changes from others allows you to collaborate more easily with other developers. Git can automatically merge changes, so two people can even work on different parts of the same file and then merge those changes without losing each other’s work.

Ways to use


Git is software that you can access through a command line (terminal) or a desktop application that has a GUI (graphical user interface) like Sourcetree shown below.

git sourcetree



A Git repository (or repository ) for short) contains all project files and revision history. You’ll take an ordinary folder of files (like the root folder of a website) and tell Git to turn it into a repository. This creates a subfolder. git, which contains all Git metadata to track changes.

On Unix-based operating systems like macOS, files and folders that start with a period (.) are hidden, so you won’t see the .git folder in macOS Finder unless you show hidden files, but it’s there! You may be able to view it in some code editors.

Organize and commit


Think of Git as keeping a list of file changes. So how do we tell Git to log our changes? Each change recorded to a file or set of files is called a commit.

Before making a commit, we must tell Git which files we want to commit. This is called staging and uses the add command. Why should we do this? Why can’t we confirm the file directly? Let’s say you’re working on two files, but only one of them is ready to confirm. You don’t want to be forced to confirm both files, just the one that’s ready. That’s where Git’s add command comes in. We add files to a staging area, and then commit the files that have been staging

for them.

Remote repositories

(on GitHub and Bitbucket) Storing a copy of your Git

repository with an online host (such as GitHub or Bitbucket) gives you a centrally located place where you can upload your changes and download changes from others, allowing you to collaborate more easily with other developers. After you set up a remote repository, upload (push) your files and revision history to it. After someone else makes changes to a remote repository, you can download (check out) your changes to your local repository.

git distributed workflow diagram

Branches and merge

Git allows you to branch out from the original codebase. This allows you to work more easily with other developers and gives you a lot of flexibility in your workflow.

Here’s an example of how useful Git branches are. Let’s say you need to work on a new feature for a website. You create a new branch and start working. You haven’t finished your new feature, but you get a request to make a hurried change that needs to be posted on the site today. You go back to the master branch, make the change and put it live. You can then return to the new feature branch and finish the job. When you’re done, merge the new feature branch into the master branch, and both the new feature and the quick switch are preserved.

When two branches are merged (or a local and remote branch is merged) it can sometimes conflict. For example, you and another developer unknowingly both work on the same part of a file. The other developer pushes their changes to the remote repository. When you take them to your local repository, you will get a merge conflict. Fortunately, Git has a way of handling conflicts, so you can look at both sets of changes and decide which ones you want to keep.


requests Pull requests are a way to analyze changes before merging them into your code base. Let’s say you’re managing a project. A developer makes changes to a new branch and wants to merge that branch into the master branch. They can create a pull request to notify you to review your code. You can discuss the changes and decide whether you want to merge it or not.

git github

Develop your skills

We offer a full suite of coding courses. Classes are small, hands-on, and expertly led. Check out our bootcamps and coding courses now:

Web Development Classes in NYC Python Programming Classes in NYC

  • Data Science
  • Classes in NYC

  • Web Design Classes
  • in NYC

Contact US