Everyday Git Workflow

Published: December 15, 2022 Last Modified: September 9, 2025

Linus Torvalds, utterly frustrated with the version control software available at the time, built Git in a ridiculously short time. Today, Git has become an essential tool for software developers and DevOps engineers worldwide. This guide covers the fundamental steps to be productive with Git when joining a new project.

The Initial Setup

Installation varies by operating system:

  • Linux/Mac: Git typically comes pre-installed
  • Linux package managers: sudo apt install git or sudo dnf install git
  • Windows: Download from Git Downloads

This guide focuses on command-line usage, which works consistently across all platforms.

Basic Configuration

Two essential commands establish your user identity:

git config --global user.name "Brad Penney"
git config --global user.email "your.email@example.com"

These settings attach your name and email to every commit you make. Use your actual name and professional email address.

Optional: Set Your Editor

Configure your preferred text editor for commit messages:

git config --global core.editor vim

I recommend vim for its universal availability. If you're not familiar with Vim yet, check out my article "Why Vim?" to learn why it's worth the investment.

Cloning Remotes

Start with an existing remote repository (whether it's new or established):

git clone git@gitlab.com:Brad_Penney/prog1700_fall_2022.git

This command:

  • Downloads the entire repository history
  • Creates a local directory matching the repository name
  • Automatically configures the remote as origin
  • Sets up tracking for the default branch

The automatic configuration prevents common setup errors when you're getting started.

Branching Out

Never commit directly to the main branch. Always create a feature or hotfix branch:

git checkout -b Brad

This creates a new branch named Brad and switches to it immediately.

Making Changes

The standard workflow for committing changes:

# Stage all changes
git add .

# Review what you're about to commit
git status

# Commit with a meaningful message
git commit -m "Always add a meaningful message! Seriously!"

# Push to your branch
git push origin <branchName>

Important: BE SURE YOU ONLY PUSH YOUR BRANCH!! Never push directly to main/master without team approval.

The Daily Merge

Keep your feature branch up-to-date by regularly merging changes from the main branch:

# Switch to main branch
git checkout master

# Get latest changes
git pull

# Switch back to your branch
git checkout <yourBranch>

# Merge main into your branch
git merge master

Daily merges typically make sense for active projects. The more frequently you merge, the smaller the conflicts will be.

Handling Merge Conflicts

When merge conflicts arise:

  1. Don't panic—they're normal
  2. Read the conflict markers carefully
  3. Consult senior developers if you're uncertain
  4. Test thoroughly after resolving conflicts

Git marks conflicts in your files with <<<<<<<, =======, and >>>>>>> markers. Edit the file to keep the correct code, remove the markers, then commit the resolution.

Summary

This workflow covers the fundamental Git operations you'll use daily:

  1. Configure your identity once
  2. Clone repositories to start working
  3. Branch for every feature or fix
  4. Commit frequently with clear messages
  5. Merge main regularly to stay current
  6. Push your branches (never main directly)

Going Deeper

This guide covers the essentials, but Git has much more to offer. For deeper learning:

Master these basics first, then explore advanced features like rebasing, cherry-picking, and Git hooks as your needs grow.