Skip to content

Commit ce1eabb

Browse files
committed
fix: updated git-workflow.md with stage branch logic
1 parent a56c30a commit ce1eabb

2 files changed

Lines changed: 140 additions & 139 deletions

File tree

CONTRIBUTING.md

Lines changed: 0 additions & 82 deletions
This file was deleted.

docs/git-workflow.md

Lines changed: 140 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,181 @@
11
# Git Workflow
22

3-
This workflow should be followed by all developers contributing to the repository.
3+
This is the step-by-step process everyone follows when contributing to this repository. If you're new to Git, read through this whole doc once before you start — every command you'll need is here.
44

5-
# Branches
5+
A few quick definitions if you're new:
66

7-
Use setup, feature, or fix branches instead of committing directly to `main`.
7+
- **Branch** — your own copy of the code to work in, so you never edit `main` or `stage` directly.
8+
- **Commit** — a saved snapshot of your changes, with a message describing what changed.
9+
- **Push** — uploading your commits from your computer to GitHub.
10+
- **Pull Request (PR)** — a request asking the leads to review your branch and merge it into `stage`.
811

9-
Examples:
12+
## `main` vs `stage`
1013

11-
```txt
12-
setup/add-prettier
13-
setup/create-folder-structure
14-
feature/add-faq-section
15-
feature/add-navigation
16-
fix/mobile-navbar
17-
```
14+
- **`main`** — the live website. **Do not branch off this or target it with PRs!**
15+
- **`stage`** — where the new website is being built. This is the default base branch for all new work.
1816

19-
# Recommended Workflow
17+
## The Workflow at a Glance
2018

21-
1. Pull the latest changes from `main`
19+
1. Pull the latest changes from `stage`
2220
2. Create a new branch
23-
3. Make changes
21+
3. Make your changes
2422
4. Test locally
25-
5. Commit changes
26-
6. Push branch
27-
7. Open pull request
28-
8. Request review
23+
5. Commit your changes
24+
6. Push your branch
25+
7. Open a pull request
26+
8. Request review from the leads
27+
28+
The leads are responsible for reviewing and merging pull requests into `stage`. Details for each step are below.
29+
30+
## Step-by-Step Guide
31+
32+
### 1. Get the latest code
33+
34+
Before starting anything new, make sure you're on `stage` and up to date, so you're not working on outdated code:
35+
36+
```bash
37+
git checkout stage
38+
git pull
39+
```
40+
41+
### 2. Create a new branch
42+
43+
Never commit directly to `stage` or `main`. Instead, create a branch off `stage` named after what you're doing. See [Branch Naming](#branch-naming) below for the naming convention.
44+
45+
```bash
46+
git checkout -b feature/add-faq-section
47+
```
48+
49+
`-b` creates the branch and switches you onto it in one step.
50+
51+
### 3. Make your changes
52+
53+
Edit the code as needed for your task.
54+
55+
### 4. Test locally
56+
57+
Before committing, make sure your code is clean and actually works:
58+
59+
```bash
60+
npm run lint
61+
npm run format:check
62+
npm run dev
63+
```
64+
65+
- `lint` catches code issues.
66+
- `format:check` makes sure your code follows the project's formatting rules (run `npm run format` to auto-fix).
67+
- `dev` starts the local site — open it in your browser and click around to confirm your change works.
68+
69+
### 5. Check what changed
70+
71+
```bash
72+
git status
73+
```
74+
75+
This lists every file you've changed. Double check:
2976

30-
# Pull Requests
77+
- Only files you actually meant to change are listed.
78+
- None of these show up (if they do, **do not commit them** — see [Rules](#rules)):
3179

32-
Before opening a pull request:
80+
```txt
81+
.env
82+
.env.local
83+
node_modules
84+
.next
85+
```
3386

34-
1. Check what files changed using:
87+
### 6. Stage and commit your changes
3588

36-
```bash
37-
git status
38-
```
89+
"Staging" means picking which changes to include in your next commit.
3990

40-
2. Ensure unrelated files are not included.
91+
```bash
92+
git add <filename> # stage one specific file
93+
git add . # or stage everything that changed
94+
```
4195

42-
3. Run:
96+
Then save the snapshot with a message (see [Commit Guidelines](#commit-guidelines) for how to write it):
4397

44-
```bash
45-
npm run lint
46-
npm run format:check
47-
```
98+
```bash
99+
git commit -m "your commit message here"
100+
```
48101

49-
4. Verify the site runs locally:
102+
### 7. Push your branch to GitHub
50103

51-
```bash
52-
npm run dev
53-
```
104+
```bash
105+
git push -u origin <branchname>
106+
```
54107

55-
5. Commit your changes:
108+
The `-u` links your local branch to the one on GitHub — you only need it the first time you push this branch. After that, `git push` alone is enough.
56109

57-
```bash
58-
git add .
59-
git commit -m "your commit message"
60-
```
110+
### 8. Open a pull request (PR)
61111

62-
6. Push your branch:
112+
1. Go to the repository on GitHub: https://github.com/HackNC/fall2026
113+
2. You'll see a banner like `<branchname> had recent pushes <time> ago`. Click **Compare & pull request**.
114+
3. **Make sure the base branch is `stage`, not `main`.** GitHub defaults to whichever branch was checked out first, so double check this before opening the PR.
115+
4. Reference the GitHub project task/issue number in the PR description (e.g. `Closes #17`) so it closes automatically when merged.
116+
5. Click **Create pull request**.
63117

64-
```bash
65-
git push
66-
```
118+
### 9. Wait for review
67119

68-
7. Open a pull request on GitHub.
120+
The leads will review your PR and either request changes or merge it into `stage`. You can keep working on something else in the meantime — no need to wait around.
69121

70-
# Commit Guidelines
122+
**Note:** Commit early, commit often. Small commits are easier to review and easier to undo if something goes wrong.
71123

72-
Write clear and specific commit messages.
124+
## Branch Naming
73125

74-
Examples:
126+
Use `setup`, `feature`, or `fix` as a prefix, followed by a short description of the work:
75127

76128
```txt
77-
chore: add Prettier configuration
78-
docs: update onboarding instructions
79-
feat: add FAQ section
80-
fix: correct mobile navigation spacing
129+
setup/add-prettier
130+
setup/create-folder-structure
131+
feature/add-faq-section
132+
feature/add-navigation
133+
fix/mobile-navbar
134+
fix/nav-alignment
81135
```
82136

83-
# Rules
137+
- `setup/` — project configuration, tooling, folder structure
138+
- `feature/` — new functionality
139+
- `fix/` — bug fixes
140+
141+
## Commit Guidelines
84142

85-
Do not commit:
143+
Prefix your commit message with the same label as your branch type, followed by a colon, then a short description of what you did:
86144

87145
```txt
146+
setup: initialize Next.js project
147+
setup: add folder structure
148+
feature: add sponsors section
149+
feature: create schedule page
150+
fix: correct nav alignment
151+
fix: resolve mobile layout issues
152+
```
153+
154+
## Rules
155+
156+
Never commit these — they either contain secrets or are auto-generated and don't belong in the repo:
157+
158+
```txt
159+
.env
160+
.env.local
88161
node_modules
89162
.next
90163
```
91164

92-
Keep pull requests focused and avoid mixing unrelated changes together.
165+
If one of these accidentally shows up in `git status`, do not run `git add .`. Add files individually instead, or ask a lead for help before committing.
166+
167+
Keep pull requests focused — one feature or fix per PR. Avoid mixing unrelated changes together, since it makes reviews harder.
168+
169+
## Common Issues
170+
171+
**I already ran `git add .` and staged something I shouldn't have.**
172+
Unstage it before committing: `git restore --staged <filename>`
93173

94-
# Important Notes
174+
**`git pull` says I have local changes that would be overwritten.**
175+
Commit or stash your work first (`git stash`), then pull, then bring your changes back (`git stash pop`).
95176

96-
Commit early and commit often.
177+
**I'm not sure what branch I'm on.**
178+
Run `git status` — the first line tells you your current branch.
97179

98-
Small focused pull requests are easier to review and safer to merge.
180+
**I have a merge conflict.**
181+
Ask a lead for help rather than guessing — conflicts are easy to resolve incorrectly if you're not sure what you're looking at.

0 commit comments

Comments
 (0)