Basic Git Workflow

Master the essential Git commands and understand the basic workflow

Learning Objectives

  • Learn how to track files using git add
  • Create meaningful commits with git commit
  • Monitor repository status with git status
  • View commit history using git log
  • Understand the basic Git workflow cycle

The Basic Git Workflow

After initializing a repository, you'll spend most of your time in the basic Git workflow cycle: making changes, staging them, and creating commits. Let's break down each step of this process.

Core Workflow Commands

Checking Status
git status
Adding Files
git add <file>
Committing Changes
git commit -m "Your message"
Viewing History
git log

Try It Yourself

Practice the basic Git workflow with this interactive demonstration:

Working Directory

index.htmluntracked
styles.cssuntracked

Git Commands

Output

No output yet. Try running a command!

Staging Changes (git add)

Common git add Usage

Add specific file
git add filename.txt
Add multiple files
git add file1.txt file2.txt file3.txt
Add all changes
git add .
Add by pattern
git add *.js

Committing Changes (git commit)

Writing Good Commit Messages

  • Creating effective ignore patterns
  • Global vs local ignore rules