DEV Community

loading...

Getting started with Git!

francescaansell profile image Francesca Ansell ・1 min read

Using Git and GitHub is one of the most popular ways to collaborate on code with other team members. When using GitHub you will have a local and remote repository (or repo).

Some key terms you should know are:

  • clone
  • pull
  • add
  • commit
  • push
  • branch

Cloning a repo creates a copy of a repo either locally or remotely. Git add puts changed files in a staging area so that they can be committed. A commit saves your changes and prepares then to be pushed. A push sends the code from your local repo to the remote repo in GitHub. A pull retrieves the code from the remote repo and merges it with your local code.

Branches are extremely useful when working with other team members. You can make different branches and then then merge them together later on. Say you want to work on a specific part of the project. If you make a branch from the current state of the project you can attempt to implement whatever you want without worry of making a catastrophic error.

This image gives an example of how merging effects your project.
image

Personally I prefer to use git in the command line. I think as a future software developer it is important to be familiar and confident in the command prompt; however, there are a variety of ways to use GitHub. Some of these ways include the command line, VS code extensions, git hub desktop, and github.com. In this video I explain using GitHub in the command line and in VS code.

Discussion (0)

pic
Editor guide