Skip to main content
Git & GitHub beginner Lesson 1 of 2

Git Workflow Essentials

Learn the core Git workflow: clone, status, commit, branch, merge, and resolve conflicts safely.

Git is the version control system that enables collaboration. As a DevOps engineer, you’ll use Git daily for:

  • shipping code via PRs
  • tracking infrastructure changes
  • automating CI/CD triggers
  • auditing history (who changed what and when)

Theory first: Git as a history model

Git is not just a command set; it is a graph of commits with pointers (branches/tags) that move over time. Commits are immutable snapshots, and collaboration is about safely moving pointers while preserving traceability.

This perspective helps you choose the right operation: commit for snapshotting, branch for parallel work, merge for integration, and rebase for local history cleanup when team policy allows.

Learning outcomes

After this tutorial you can:

  • create commits from a clean workflow
  • branch safely
  • merge and resolve conflicts

1) Clone & inspect

# clone a repo
git clone https://github.com/org/repo.git

# enter repo
cd repo

# see status
git status

2) Staging & committing

# stage a file
git add README.md

# stage all changes
git add -A

# create a commit (message is required)
git commit -m "Add onboarding guide"

Commit message guidance

A common pattern:

  • short summary (imperative)
  • optional body describing why

Example:

Fix prod restart loop

systemd was failing due to permissions on /var/log/app.

3) Branching (standard team model)

# create a feature branch
git checkout -b feature/linux-networking

# later, switch back
git checkout main

4) Merging

# merge feature into main
git checkout main
git merge feature/linux-networking

Merge conflicts (what to do)

When Git pauses:

  1. open the conflicted files
  2. decide the final content
  3. stage resolved files
  4. complete merge
# see which files conflicted
git status

# after resolving
git add path/to/conflicted-file

git commit

5) Log (audit and debugging)

# compact history
git log --oneline --decorate --graph -20

# what changed in a commit
git show <commit-sha>

Next steps

Continue with:

  • Git branching strategies (PR-based workflows)
  • GitHub collaboration concepts (issues, PRs)
  • GitHub Actions CI/CD (automate checks)

Frequently Asked Questions

Should I use git pull --rebase?
For many teams it helps keep history linear, but follow your team’s policy. The key is consistent practice and understanding when rebase rewrites commits.
What does ‘staging’ mean?
Staging is selecting the exact changes you want in the next commit. It creates a snapshot boundary between your working directory and commit history.