Step 1: Get the latest main
- Go to your project folder:
cd path/to/your-repo- Confirm you’re in a Git repo and see what’s happening:
git statusgit status shows what files changed and which branch you are on.
- Switch to
mainand update it:
git switch main
git pullgit pull fetches changes from the remote and merges them into your current branch.
Step 2: Create a branch for one feature
- Create and switch to a new branch (example feature: “Export CSV”):
git switch -c feature/export-csvGitHub Flow recommends creating a branch for each change so you can work without affecting the default branch.[2][1]
- (Optional) Verify you’re on the new branch:
git statusThis helps beginners avoid accidentally committing to main.
Step 3: Make changes and commit (save progress)
- Edit code as usual, then check what changed:
git statusThis shows what Git sees as modified/untracked.
- Stage the files you want to include in the next “snapshot”:
git add .git add prepares changes to be included in the next commit.
- Create a commit with a clear message:
git commit -m "Add CSV export for expenses"A commit records your staged snapshot into the project history.
- Repeat steps (edit → add → commit) as you continue, so your feature is built in small checkpoints.
Step 4: Push your branch to GitHub
- Push the new branch (first time only, use
-u):
git push -u origin feature/export-csvGit’s cheat sheet shows git push -u origin <name> for pushing a branch you’ve never pushed before.
- Next pushes can be just:
git pushOnce tracking is set, git push pushes the current branch to its tracking branch.
Step 5: Open a Pull Request (PR)
- On GitHub, open a PR from
feature/export-csvintomain. - A PR is how you propose merging a branch into another branch and keep discussion/review attached to the change.
Step 6: Merge the PR safely
- After checks/review, merge the PR so your branch changes appear on
main. - GitHub supports multiple merge methods (merge commit / squash / rebase), depending on repo settings and what history style you want.
Step 7: Sync main and clean up
- Update your local
mainafter merge:
git switch main
git pullThis ensures your local main matches the merged result on the remote.
- Delete the local feature branch (only after it’s merged):
git branch -d feature/export-csvThis keeps your local branch list clean.
Step 8: (Recommended) Tag your demo version
When main reaches “demo-ready”, add a tag so you can always return to the exact demo code:
git tag v0.1.0-demo
git push origin v0.1.0-demoGit can push tags to the remote so teammates/CI can reference the same demo build.