Skip to content

Latest commit

 

History

History
490 lines (331 loc) · 5.96 KB

File metadata and controls

490 lines (331 loc) · 5.96 KB

PR Creation Methodology


Quick Workflow Summary

mkdir <folder_name>
cd ../<folder_name>

git clone <fork-url>

git remote add upstream <original-repo>

git checkout -b <branch-name>

# make changes

git add .
git commit -m "message"

git push origin <branch-name>

If things do not appear automatically on the repo page asking to compare and pull, then do this:

https://github.com/<owner>/<repo>/compare

Safety from brnaching through regular pull and rebase

mkdir <folder_name>
cd <folder_name>

git clone <fork-url>
cd <repo-name>

git remote add upstream <original-repo>

git fetch upstream
git checkout main
git pull upstream main
git checkout <branch-name>
git pull upstream <branch-name>

git checkout -b <branch-name>

# make changes

git add .
git commit -m "message"

# safety sync before pushing
git fetch origin
git pull --rebase origin <branch-name>  # if branch already exists remotely

# if shows fatal/ conflict (auto merge failing); resolve conflicts and proceed with further steps
git add .
git rebase --continue
# repeat these two steps until sorted (or until taken to commit page)

git push -u origin <branch-name>

# creates the compare and pull request on main page
gh pr create --web

To visualise branching

git log --oneline --graph --decorate --all

To understand what went wrong

git fetch origin
git status
git branch -vv
git log --oneline --graph --decorate --all -20

Create a folder locally

mkdir -p /Users/shaarav/Documents/<Folder>/.../<Folder>/<Project>

Move to that folder

cd /Users/shaarav/Documents/<Folder>/.../<Folder>/<Project>

Fork the repository

  • Open GitHub
  • Click Fork
  • Fork into your own account

Clone your fork

git clone <YOUR_FORK_URL>

Move into repository

cd <repo-name>

Add upstream remote

git remote add upstream <ORIGINAL_REPO_URL>

Verify remotes

git remote -v

Expected:

origin    <YOUR_FORK_URL>
upstream  <ORIGINAL_REPO_URL>

Sync Fork With Main Repository

Fetch latest upstream changes

git fetch upstream

Switch to main branch

git checkout main

Reset local main to upstream

git reset --hard upstream/main

Push updated main to your fork

git push origin main --force

Create Feature Branch

Create new branch

git checkout -b <feature-branch-name>

Examples:

git checkout -b fix-auth-race-condition
git checkout -b improve-logging
git checkout -b add-rate-limiter

Make Changes

Open Antigravity IDE

open -a "Antigravity" .

Open Visual Studio Code IDE

open -a "Visual Studio Code" .

Open Cursor IDE

open -a "Cursor" .

Open Codex IDE

open -a "Codex" .

Before Committing

See changed files

git status

See exact changes

git diff

Review staged changes

git diff --staged

Run tests

<project-test-command>

Examples:

npm test
cargo test
pytest
pnpm test

Commit Changes

Stage files

git add .

OR specific files:

git add <file-name>

Commit changes

git commit -m "<commit-message>"

Good examples:

git commit -m "Fix race condition in websocket handler"
git commit -m "Improve MongoDB reconnection logic"
git commit -m "Add validation for empty API keys"

Avoid:

git commit -m "fix"
git commit -m "changes"
git commit -m "update"

Push Branch

Push branch to your fork

git push origin <feature-branch-name>

Create Pull Request

Open GitHub

  • Navigate to your fork
  • Click Compare & Pull Request

PR Title Rules

Use clear titles:

Fix websocket memory leak
Add retry logic for failed requests
Improve error handling in auth middleware

Avoid:

Fixed stuff
Changes made
Update

PR Description Template

## What does this PR do?
- 

## Why is this needed?
- 

## Changes made
- 
- 
- 

## Testing done
- 

## Screenshots / Recordings (if applicable)
- 

## Checklist
- [ ] Code builds successfully
- [ ] Tests pass
- [ ] No unnecessary files added
- [ ] Documentation updated if needed
- [ ] PR is focused on one issue only

Keep PR Updated With Latest Main

Fetch upstream

git fetch upstream

Switch to main

git checkout main

Reset main

git reset --hard upstream/main

Return to feature branch

git checkout <feature-branch-name>

Rebase branch onto latest main

git rebase main

If conflicts happen:

git status

Resolve conflicts manually, then:

git add .
git rebase --continue

Update Existing PR

Push rebased changes

git push origin <feature-branch-name> --force

Clean Up After Merge

Switch to main

git checkout main

Delete local branch

git branch -D <feature-branch-name>

Delete remote branch

git push origin --delete <feature-branch-name>

Important Contributor Rules

  • Keep PRs focused on ONE issue/problem
  • Avoid unrelated formatting changes
  • Avoid huge PRs unless necessary
  • Test before opening PR
  • Re-read changed code before pushing
  • Keep commit messages meaningful
  • Respond to review comments properly
  • Never commit secrets/API keys/.env files
  • Avoid AI-generated code without reviewing it carefully
  • Prefer clarity over over-engineering

Helpful Git Commands

Show branch graph

git log --oneline --graph --all

Show commit history

git log --oneline

Undo latest commit (keep changes)

git reset --soft HEAD~1

Undo latest commit (delete changes)

git reset --hard HEAD~1

Remove untracked files

git clean -fd

Abort rebase

git rebase --abort

Abort merge

git merge --abort