Web BuildingBeginner

Git & GitHub Workflows

Version control your code with Git and collaborate using GitHub - branching, PRs, and CI basics.

3 hours
5 key concepts
3 in-depth sections
Official Docs

0 of 5 concepts completed (0%)

What You'll Learn

1.Core Commands

bash
# Initialize & clone
git init
git clone https://github.com/user/repo.git

# Stage & commit git status git diff # unstaged changes git diff --staged # staged changes git add . git add -p # interactive staging git commit -m "feat: add login form" git commit --amend # modify last commit git commit --amend --no-edit # add staged to last commit

# Branching git switch -c feature/login # create + switch (modern) git switch main git branch -d feature/login # delete merged branch

# Remote git push -u origin main # push + set upstream tracking git pull --rebase # fetch + rebase (cleaner than merge) git fetch --all --prune # update all remotes, remove deleted ```

2.Branching Strategies

GitHub Flow for continuous deployment `` main → always deployable, protected feature/* → branch from main → PR → review → merge → deploy ``

Conventional Commits format: ``bash # type(scope): description git commit -m "feat(auth): add refresh token rotation" git commit -m "fix(ui): correct button alignment on mobile" git commit -m "docs: update API authentication guide" git commit -m "refactor: extract user service" ``

types: feat, fix, docs, style, refactor, test, chore, ci, perf, BREAKING CHANGE

3.Advanced Git

bash
# Interactive rebase rewrite history
git rebase -i HEAD~3       # edit last 3 commits

# Cherry-pick git cherry-pick abc1234 # apply one commit to current branch

# Stashing git stash push -m "wip: login form" git stash list git stash pop git stash apply stash@{2}

# Bisect find breaking commit git bisect start git bisect bad # current state is broken git bisect good v1.0.0 # this was working # Git checks out middle commit... git bisect good/bad # mark and continue git bisect reset

# Reflog recover lost work git reflog git reset --hard HEAD@{3} ```

Code Example

# Initialize and push
git init
git add .
git commit -m "feat: initial commit"
git remote add origin https://github.com/user/repo.git
git push -u origin main

# Feature branch workflow
git checkout -b feature/login
# ...make changes...
git add .
git commit -m "feat: add login form"
git push origin feature/login
# Open Pull Request on GitHub

# Keep branch up to date
git fetch origin
git rebase origin/main

Pro Tips

  • 1Commit early and often with meaningful messages. Small atomic commits are far easier to revert, cherry-pick, or bisect.
  • 2Use git stash when you need to switch branches with uncommitted work. Name stashes with -m 'description' for clarity.
  • 3Never force-push to shared branches. Use --force-with-lease if you must force-push to your own feature branch.
  • 4git reflog is your time machine it shows every HEAD position for the last 90 days, letting you recover 'lost' commits.

Topics Covered

GitGitHubVersion Control

Continue Learning

Explore the official documentation and deepen your knowledge with real-world practice.

Explore the Full Portfolio

This is the complete portfolio of Sufi Khan Sulaiman, a technology leader specialising in B2B commerce and digital automation. Start from the Home page for the overview, then move through two decades of career experience across FLIR Systems, Lorex Technology, and 1c Platform, and the full catalogue of project case studies spanning headless commerce migrations, AI recommendation engines, and multi-channel fulfilment systems.

The skills and certifications page maps the technical and leadership capabilities behind the work, while the articles and the knowledge base break down the thinking into actionable frameworks. For hands-on learning, the tutorials and applications sections cover practical builds from front-end fundamentals to full-stack web apps.

For consulting engagement, the expertise page outlines service offerings, the ecommerce hub covers platform architecture and automation strategy, and the ecommerce guide (PDF) is a downloadable 55-page field manual. When you are ready to talk, the contact page is the direct line.