Basic Git Workflow

An introduction to Git and a few of its core features

Start[missing "en.views.course_landing_page.learn-git.course_illustration" translation]

Key Concepts

Review core concepts you need to learn to master this subject

Initializing a Git Repository

$ cd /home $ git init

The git init command creates or initializes a new Git project, or repository. It creates a .git folder with all the tools and data necessary to maintain versions. This command only needs to be used once per project to complete the initial setup. For instance, the code block sets up the home folder as a new git repository.

Checking the Status of a Git Repository

$ cd /home $ git init

The git status command is used within a Git repository to its current status including the current commit, any modified files, and any new files not being tracked by Git.

The output of git status can vary widely, and it often includes helpful messages to direct the user to manage their repository. For example, git status will show the user the files they would commit by running git commit and the files they could commit by running git add before running git commit.

Basic Git Workflow
Lesson 1 of 1
  1. 1

    Git is a software that allows you to keep track of changes made to a project over time. Git works by recording the changes you make to a project, storing those changes, then allowing you to referen...

  2. 2

    Now that we have started working on the screenplay, let’s turn the sorcerers-code directory into a Git project. We do this with: [...] The word [...] means initialize. The command set...

  3. 3

    Nice! We have a Git project. A Git project can be thought of as having three parts: 1. A Working Directory: where you'll be doing all the work: creating, editing, deleting and organizing files 2...

  4. 4

    As you write the screenplay, you will be changing the contents of the working directory. You can check the status of those changes with: [...]

  5. 5

    In order for Git to start tracking scene-1.txt, the file needs to be added to the staging area. We can add a file to the staging area with: [...] The word [...] here refers to the n...

  6. 6

    Good work! Now you know how to add a file to the staging area. Imagine that we type another line in scene-1.txt. Since the file is tracked, we can check the differences between the working di...

  7. 7

    A commit is the last step in our Git workflow. A commit permanently stores changes from the staging area inside the repository. [...] is the command we'll do next. However, one more bit of cod...

  8. 8

    Often with Git, you'll need to refer back to an earlier version of a project. Commits are stored chronologically in the repository and can be viewed with: [...]

  9. 9

    You have now been introduced to the fundamental Git workflow. You learned a lot! Let's take a moment to generalize: Git is the industry-standard version control system for web developers Use Gi...

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo

Basic Git Workflow

Start[missing "en.views.course_landing_page.learn-git.course_illustration" translation]