Key Points

Setup Instructions


  • GitHub, VS Code, bash, and git are needed for this lesson

Introduction to Git & GitLab


  • Version control helps track changes to files and projects
  • Git and GitLab are not the same
  • Git commands are written as git verb options

Create a GitLab Repository


  • Create a new repository on GitLab
  • Clone the repository to your local computer
  • Open the terminal in VS Code

Setup Git Configs


  • Version control helps track changes to files and projects
  • Git and GitLab are not the same
  • Git commands are written as git verb options
  • When we use Git on a new computer for the first time, we need to configure a few things

Tracking Changes


  • git status shows the status of a repository.
  • Files can be stored in a project’s working directory (which users see), the staging area (where the next commit is being built up) and the local repository (where commits are permanently recorded).
  • git add puts files in the staging area.
  • git commit saves the staged content as a new commit in the local repository.
  • Always write a log message when committing changes.

Pushing changes to GitLab


  • A local Git repository can be connected to one or more remote repositories.
  • git push copies changes from a local repository to a remote repository.
  • git pull copies changes from a remote repository to a local repository.

Branches


  • Branches can be useful for developing while keeping the main line static.

Merge Requests


  • Merge requests suggest changes to repos where you don’t have privileges

[Optional] Resolving Conflicts


  • Conflicts occur when files are changed in the same place in two commits that are being merged.
  • The version control system does not allow one to overwrite changes blindly during a merge, but highlights conflicts so that they can be resolved.