Test

Nice — here’s a complete, start-to-finish checklist for working locally on a GitHub repo when develop is the default branch and every story must be worked in a new branch. Use it as your daily playbook.

Quick assumptions

  • Git is installed and you have a GitHub account.
  • You have permission to push to the repo (or you’ll fork it).
  • The team’s canonical long-lived integration branch is develop.

1) One-time local setup

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

(Optional) set up credential helper / SSH keys if not already done.


2) Clone the repo (or fork + clone)

If you can push directly:

git clone git@github.com:org/repo.git
cd repo

If you must fork (common in open-source / limited perms):

  1. Fork on github.com → your-username/repo
  2. Then locally:
git clone git@github.com:your-username/repo.git
cd repo
git remote add upstream git@github.com:org/repo.git   # upstream = original repo

Confirm remotes:

git remote -v

3) Start from an up-to-date develop

Always create feature branches from the latest develop:

git fetch origin
git checkout develop
git pull origin develop

If you forked, also fetch upstream first:

git fetch upstream
git checkout develop
git merge upstream/develop    # or: git pull upstream develop
git push origin develop       # update your fork if needed

4) Create a new branch for the story

Use a clear naming convention — include ticket ID and short description:

git checkout -b story/PROJ-123-short-description

Examples: story/PROJ-123-login-button, feat/PROJ-456-user-settings.


5) Do focused local work

  • Edit files, run tests, run linters, run build locally.
  • Make small, focused commits.

Good commit examples:

git add src/components/LoginButton.jsx
git commit -m "PROJ-123: Add LoginButton component"

For multi-line:

git commit
# write short summary line, blank line, then longer description

6) Push the branch to origin

git push -u origin story/PROJ-123-short-description

-u sets upstream so later git push/git pull are simpler.


7) Open a Pull Request (PR) to develop

  • On GitHub create PR: base = develop, compare = story/PROJ-123...
  • PR title: PROJ-123 — short summary
  • PR body should include:
    • What changed
    • Ticket/issue link (Fixes PROJ-123 or Closes #42)
    • How to test (steps)
    • Any migration/schema changes
    • Screenshots or logs if relevant
      Example PR body:
Fixes: PROJ-123

Adds the LoginButton component and integrates with auth service.

How to test:
1. npm install
2. npm start
3. Visit /login and click the Login button (see screenshot)

Notes:
- no DB migrations
- adds unit tests for LoginButton

Use Draft PRs while work is in progress.


8) CI runs and code review

  • Wait for CI (tests, lint) to pass.
  • Address reviewer comments by committing to the same branch:
# make changes
git add .
git commit -m "PROJ-123: adjust styling per review"
git push
  • If reviewers request squashing or rebasing, follow repo policy.

9) Keeping your branch up to date with develop

If develop advances while you work, keep your branch current. Two common approaches — pick your team’s policy:

A) Merge develop into your branch (safe, non-rewriting)

git fetch origin
git checkout story/PROJ-123-short-description
git merge origin/develop
# resolve conflicts, commit, then:
git push

B) Rebase onto develop (clean linear history — rewrites commits)

git fetch origin
git checkout story/PROJ-123-short-description
git rebase origin/develop
# resolve conflicts, then:
git push --force-with-lease

Use --force-with-lease (safer) — notify reviewers if you force-push.


10) Finalize and merge

Once approved and CI is green, merge into develop following repo merge strategy:

  • Squash & merge — good for single-commit PRs and tidy history.
  • Rebase & merge — keeps linear history.
  • Create a merge commit — preserves branch history.

If you must merge locally:

git checkout develop
git pull origin develop
git merge --no-ff story/PROJ-123-short-description
git push origin develop

(Only do this if repo policies allow local merging.)


11) Post-merge cleanup

Delete remote branch:

git push origin --delete story/PROJ-123-short-description

Delete local branch:

git branch -d story/PROJ-123-short-description
# if it was not merged for some reason: git branch -D <branch>

Pull the updated develop:

git checkout develop
git pull origin develop

12) Final tasks

  • Update ticket (move to Done, add notes).
  • Run a local or staging smoke test if required.
  • If your change deploys migrations or requires a release note, do that.

Short checklist (TL;DR)

  1. git fetch origin && git checkout develop && git pull origin develop
  2. git checkout -b story/PROJ-123-short-description
  3. Code, test, commit (good messages with ticket ID)
  4. git push -u origin story/PROJ-123-short-description
  5. Open PR → base: develop
  6. Fix review comments on same branch, push updates
  7. Keep branch up to date (merge or rebase develop)
  8. Merge PR to develop when approved + CI green
  9. Delete remote & local branch, update ticket

Tips & common gotchas

  • Always include the ticket ID in commits and PR titles for traceability.
  • Never commit secrets or .env files.
  • Prefer small PRs for faster reviews.
  • Use Draft PRs while still implementing.
  • When rebasing: coordinate with reviewers and use --force-with-lease.
  • If you accidentally force-pushed wrong, git reflog can help recover commits.

Want a printable one-page cheat sheet or a ready-to-paste PR template? I can create either now.

Leave a Reply

Your email address will not be published. Required fields are marked *