Lesson 3 of 19 ↓
- 1.Fedora + Distrobox + Arch + AUR Setup Guide
- 2.Enabling Hibernate on Linux
- 3.A Practical Git Workflow
- 4.Useful Linux Commands & Tips
- 5.Mirroring Your Android Screen with Scrcpy
- 6.Downloading Media with Yt-dlp
- 7.Consistent C/c++ Style with Clang-format
- 8.Auto-mounting Drives at Boot
- 9.Customizing Grub
- 10.Linux Swap Files Explained
- 11.Zram: Compressed Swap in Ram
- 12.Custom App Launch Behavior Via .desktop Files
- 13.Custom Mime Icons in Gnome
- 14.Fixing Missing Dock Icons (startupwmclass)
- 15.Installing Questasim for Hdl Simulation
- 16.Building Python 2 From Source
- 17.Auto-Starting WhatsApp and Telegram (Minimized or Tray)
- 18.Custom Neovim Configuration Guide
- 19.Running Windows Applications on Linux Seamlessly with WinBoat (Docker)
1 min read
A Practical Git Workflow
This walks through the complete day-to-day loop for contributing to a repository: cloning it, working on a branch, committing, pushing, opening a pull request, and staying in sync with everyone else's changes. It's the same handful of commands used for nearly every change, so it's worth having down as muscle memory rather than looking it up each time.
Clone the Repository
git clone https://github.com/username/repository-name.git
cd repository-nameCreate a New Branch
Work on a separate branch instead of editing main directly — it keeps changes organized and means main is never in a half-finished state.
git checkout -b your-branch-namegit checkout -b new-branch # exampleMake Your Edits
Open the project in an editor and make the changes:
nvim .Stage and Commit
Stage everything that changed:
git add .Commit with a message that says why, not just what:
git commit -m "Describe what you changed"Push the Branch
git push origin new-branchOpen a Pull Request
- Go to the repository page on GitHub.
- GitHub shows a banner for the branch just pushed, with a Compare & pull request button.
- Click it, review the diff, add a title and description, and submit.
- Once approved, merge it.
Alternative (not recommended for teams): with direct write access it's possible to push straight to
main, but branches + pull requests catch mistakes before they land and give reviewers something concrete to comment on.
Keep the Local Repo in Sync
Once other people's work lands on main, pull it before starting anything new to avoid unnecessary conflicts:
git checkout main
git pull origin main
Comments
Loading the discussion…