Here’s a comprehensive Git Gist tailored for both Fellow-level BI & Analytics Engineers and Fellow-level Fullstack Software Engineers. This Gist covers advanced workflows, best practices, and tips for collaboration, scalability, and maintainability—key for senior engineers in both domains.
For Fellow-Level BI & Analytics Engineers & Fullstack Software Engineers
- Branching Models: Use
git floworGitHub Flowfor structured releases. - Rebase vs. Merge: Prefer
rebasefor clean history,mergefor public branches. - Stashing:
git stashfor temporary changes without committing.
- Pull Requests (PRs):
- Template: Enforce PR templates with context, impact, and testing notes.
- Review: Require 2+ approvals for critical changes.
- CI/CD: Integrate automated tests (e.g., GitHub Actions, GitLab CI).
- Squashing: Use
git merge --squashto consolidate commits before merging.
- Shallow Clones:
git clone --depth 1for large repos. - Submodules: Manage dependencies with
git submodule. - Large Files: Use
git lfsfor datasets, binaries, or models.
- Data Versioning: Track datasets with
DVC(Data Version Control) alongside Git. - Notebooks: Use
nbdimefor Jupyter notebook diffs. - SQL Scripts: Version-control SQL in
/sql/with clear naming conventions.
- Monorepos: Use tools like
lernaornxfor multi-package projects. - Environment Parity: Use
.gitignoreto exclude local configs (e.g.,.env). - Docker Integration: Commit
Dockerfilesanddocker-compose.ymlfor reproducibility.
- Secrets: Never commit API keys; use
git-secretsor.gitignore. - Signed Commits: Enforce GPG-signed commits for critical projects.
- Audit Logs: Regularly audit
git logfor anomalies.
- Bisect:
git bisectto find regression commits. - Reflog:
git reflogto recover lost commits/branches. - Blame:
git blameto trace changes (use sparingly in collaborative settings).
- Hooks: Use
pre-commithooks for linting (e.g.,black,flake8). - Bots: Automate PR labeling/merging with tools like
Renovate. - CLI Aliases: Customize Git with aliases (e.g.,
git config --global alias.lg "log --graph").
When working with untracked local files in a feature branch and preparing to merge:
-
Stash local changes (including untracked files):
git stash -u -m "local test files" -
Switch to main and merge:
git checkout main git merge feature-branch
-
Create new branch from main and apply stashed files:
git checkout -b new-feature-branch git stash apply
✅ Only stashed changes meant for reuse are applied — keep
mainclean of local-only files.
- README.md: Include setup, architecture, and contribution guidelines.
- CHANGELOG.md: Track releases and breaking changes.
- GitHub Wiki: For project-specific workflows.
- Mentorship: Document Git best practices for junior engineers.
- Postmortems: Use Git history to analyze incidents.
- Open Source: Contribute back to tools like
dbt,Airflow, orReact.
# Feature branch
git checkout -b feature/analytics-dashboard
# Commit with context
git commit -m "feat: add revenue KPI dashboard
- Uses Redshift data
- Tests in Looker"
# Push and open PR
git push origin feature/analytics-dashboard
gh pr create --fill# Rebase on main
git fetch origin
git rebase origin/main
# Squash commits
git reset --soft HEAD~3
git commit -m "feat: implement OAuth2 flow"
# Tag release
git tag -a v1.2.0 -m "Release v1.2.0"
git push origin v1.2.0| Tool | Use Case |
|---|---|
DVC |
Data versioning |
GitHub Actions |
CI/CD pipelines |
pre-commit |
Code quality hooks |
Renovate |
Dependency updates |
- Consistency: Agree on conventions (e.g., commit messages, branch names).
- Transparency: Document decisions in PRs/issues.
- Adaptability: Evolve workflows as the team scales.
Here’s a tailored, stack-specific Git Gist for Fellow-level BI & Analytics Engineers (AWS + dbt) and Fullstack Software Engineers, with a focus on cross-functional collaboration and scalability for teams of 10+ engineers.
For Teams of 10+ Engineers
Branching:
- Use
main(production),staging, and feature branches (e.g.,feature/add-snowflake-source). - Enforce linear history with
rebase(no merge commits).
dbt Integration:
- Version-control dbt models in
/models/with clear prefixes:/models/ ├── staging/ ├── marts/ └── seeds/ - Use
dbt docs generateand committarget/catalog.jsonfor documentation.
AWS-Specific:
- Terraform/IaC: Store in
/infrastructure/; useterragruntfor DRY config. - Glue/EMR Scripts: Version-control in
/scripts/with.gitignorefor*.log. - Data Pipelines: Track Airflow DAGs in
/dags/withgit lfsfor large dependencies.
Example:
# dbt workflow
git checkout -b feature/add-customer-mart
dbt run --models +customer_mart
git add models/marts/customer/
git commit -m "feat: add customer lifetime value model"
git push origin feature/add-customer-martBranching:
main(prod),develop(staging), and feature branches (e.g.,feature/auth0-integration).- Use semantic commits (e.g.,
fix:,feat:,chore:).
Monorepo Tips:
- Use
lernaornxfor shared libraries (e.g., UI components, utilities). - Example structure:
/packages/ ├── frontend/ (React) ├── backend/ (Node) └── shared/ (TypeScript libs)
Docker:
- Commit
Dockerfileanddocker-compose.yml; ignorenode_modules/and.env. - Use
docker build --tag myapp:v1.2.0with Git tags.
Example:
# Fullstack feature
git checkout -b feature/add-payment-gateway
cd packages/backend && npm install stripe
git add packages/backend/package.json
git commit -m "feat: add Stripe integration"Shared Ownership:
- BI + DevOps: Use
CODEOWNERSto auto-assign PRs for infrastructure changes. - Frontend + BI: Document API contracts in
/docs/api/(OpenAPI/Swagger).
PR Templates:
## [BI/Fullstack] Description
- **Jira Ticket**: [LINK]
- **Impact**: [Metrics/Dashboards/APIs affected]
- **Testing**: [dbt tests/Postman collection]
- **Screenshots**: [For UI changes]CI/CD:
- BI: Run
dbt testin GitHub Actions on PR. - Fullstack: Run
npm test+docker buildin parallel.
Code Reviews:
- Rotate reviewers weekly; use pair programming for complex changes.
- Require video walkthroughs for major features.
Documentation:
- Architecture Decisions: Track in
/docs/adr/(e.g.,001-use-dbt-cloud.md). - Onboarding: Maintain a
CONTRIBUTING.mdwith setup guides.
Tools:
| Tool | BI Use Case | Fullstack Use Case |
|---|---|---|
DVC |
Version Snowflake data | N/A |
Sentry |
Monitor dbt runs | Frontend error tracking |
Datadog |
Pipeline observability | Backend APM |
- BI: Backup dbt
manifest.jsonandcatalog.jsonin S3. - Fullstack: Use
git archivefor point-in-time restores.
Title: feat: add user activity dashboard
Description:
- BI: New dbt model (
user_activity.sql) + Looker dashboard. - Fullstack: New API endpoint (
/api/activity) + React component. - Testing: dbt tests + Jest/RTL.
Here’s your expanded Git Gist, now including detailed merge conflict resolution for dbt and React, plus GitHub Actions workflows for both BI (AWS + dbt) and Fullstack (React/Node) stacks.
Merge conflicts in dbt often occur in:
- SQL files (e.g.,
models/marts/customer_dimension.sql) - YAML files (e.g.,
dbt_project.yml,schema.yml)
-
Pull Latest Changes:
git fetch origin git rebase origin/develop # or main -
Identify Conflicts:
- Use
git statusto find conflicted files. - Open the file; conflicts are marked with
<<<<<<<,=======,>>>>>>>.
- Use
-
Resolve SQL Conflicts:
- Example:
<<<<<<< HEAD select user_id, sum(revenue) as lifetime_value from {{ ref('stg_orders') }} ======= select user_id, sum(amount) as lifetime_value from {{ ref('stg_payments') }} >>>>>>> feature/new-metrics
- Fix: Decide which logic to keep (or combine both):
select user_id, sum(revenue) as lifetime_value from {{ ref('stg_orders') }} -- Added payments data for accuracy union all select user_id, sum(amount) as lifetime_value from {{ ref('stg_payments') }}
- Example:
-
Resolve YAML Conflicts:
- Example (
dbt_project.yml):models: marts: +schema: analytics <<<<<<< HEAD +materialized: table ======= +materialized: incremental >>>>>>> feature/incremental-models
- Fix: Choose the correct materialization strategy.
- Example (
-
Mark as Resolved:
git add models/marts/customer_dimension.sql git rebase --continue
Merge conflicts in React/Node often occur in:
- Component files (e.g.,
Button.jsx) - Package files (e.g.,
package.json) - Configuration files (e.g.,
webpack.config.js)
-
Pull Latest Changes:
git fetch origin git rebase origin/develop
-
Resolve Component Conflicts:
- Example (
Button.jsx):<<<<<<< HEAD const Button = ({ onClick, label }) => ( <button className="btn-primary" onClick={onClick}> {label} </button> ); ======= const Button = ({ onClick, children }) => ( <button className="btn-secondary" onClick={onClick}> {children} </button> ); >>>>>>> feature/new-button-styles
- Fix: Combine props and styles:
const Button = ({ onClick, label, children }) => ( <button className="btn-primary btn-secondary" onClick={onClick}> {label || children} </button> );
- Example (
-
Resolve
package.jsonConflicts:- Use
npm installafter resolving to updatepackage-lock.json.
- Use
-
Mark as Resolved:
git add src/components/Button.jsx git rebase --continue
# .github/workflows/dbt-pr-check.yml
name: dbt PR Check
on:
pull_request:
branches: [develop, main]
paths:
- 'models/**'
- 'dbt_project.yml'
jobs:
dbt-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dbt
run: pip install dbt-core dbt-postgres
- name: Run dbt deps
run: dbt deps
- name: Run dbt test
run: dbt test --select state:modified
env:
DBT_PROFILES_DIR: .# .github/workflows/dbt-prod-deploy.yml
name: dbt Production Deploy
on:
push:
branches: [main]
paths:
- 'models/**'
- 'dbt_project.yml'
jobs:
dbt-run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dbt
run: pip install dbt-core dbt-postgres
- name: Run dbt prod
run: dbt run --full-refresh
env:
DBT_PROFILES_DIR: .
DBT_ENV_SECRET: ${{ secrets.DBT_PROD_ENV }}# .github/workflows/frontend-pr-check.yml
name: Frontend PR Check
on:
pull_request:
branches: [develop, main]
paths:
- 'packages/frontend/**'
jobs:
test-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build
run: npm run build# .github/workflows/backend-prod-deploy.yml
name: Backend Production Deploy
on:
push:
branches: [main]
paths:
- 'packages/backend/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Deploy to AWS
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-southeast-1
- name: Deploy with Serverless
run: npx serverless deploy --stage prod- Use
git rerere: Enable "reuse recorded resolution" to auto-resolve recurring conflicts:git config --global rerere.enabled true - Automate PR Labels: Use GitHub Actions to label PRs by size (e.g.,
small,large) or type (e.g.,bug,feature). - Branch Protection: Require status checks (CI) and 2+ approvals for
main/develop.
Here’s your final, comprehensive Git Gist, now including a troubleshooting guide for CI/CD failures and an onboarding checklist for new engineers.
| Issue | Root Cause | Solution |
|---|---|---|
dbt test fails on PR |
Missing or incorrect test data | Update data/tests/ or seed files; run locally first. |
dbt run fails in production |
Profile misconfiguration | Check profiles.yml and secrets; test with dbt debug. |
dbt deps fails |
Missing or incorrect package version | Update packages.yml; run dbt clean and retry. |
| GitHub Actions stuck | Runner out of memory | Use a larger runner (e.g., ubuntu-20.04-8core). |
| Permission denied on S3/Redshift | Incorrect IAM roles or secrets | Verify DBT_ENV_SECRET and AWS credentials in GitHub Secrets. |
- Reproduce Locally:
dbt deps dbt run --models +your_model
- Check Logs:
- Look for
ERRORorFAILin GitHub Actions logs.
- Look for
- Validate Secrets:
- Ensure
DBT_PROFILES_DIRand environment variables are set.
- Ensure
| Issue | Root Cause | Solution |
|---|---|---|
npm install fails |
Corrupted package-lock.json |
Delete node_modules/ and package-lock.json; run npm install. |
| Tests fail on PR | Missing test data or environment vars | Mock API calls; check .env.test. |
| Build fails | Webpack/config issue | Run npm run build locally; check webpack.config.js. |
| AWS deployment fails | Incorrect IAM permissions | Verify AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in GitHub Secrets. |
| Serverless deploy hangs | Timeout or missing dependencies | Increase timeout; check serverless.yml for missing plugins. |
- Reproduce Locally:
npm ci npm test npm run build - Check Logs:
- Look for
ERRORor stack traces in GitHub Actions.
- Look for
- Validate Secrets:
- Ensure AWS credentials and environment variables are correct.
- GitHub Access: Invite to the org/repo; assign to the correct team.
- SSH Keys: Add public key to GitHub.
- Secrets: Share
.env.exampleand instructions for local setup. - AWS Access: Grant IAM user with least-privilege permissions (if applicable).
- Clone Repo:
git clone git@github.com:your-org/your-repo.git cd your-repo - Install Dependencies:
- BI:
pip install -r requirements.txt - Fullstack:
npm ci
- BI:
- Run Locally:
- BI:
dbt run - Fullstack:
npm start
- BI:
- Branch Strategy: Explain
main/develop/featurebranches. - Commit Conventions: Share commit message guidelines (e.g.,
feat:,fix:). - PR Process: Walk through creating a PR, requesting reviews, and merging.
- CI/CD: Explain how GitHub Actions works for the project.
- BI:
- Review dbt model structure (
staging,marts). - Explain how to add a new model and document in
schema.yml.
- Review dbt model structure (
- Fullstack:
- Review React component structure and state management.
- Explain API routes and database schema.
- Standups: Invite to daily/weekly syncs.
- Documentation: Share links to
README.md,CONTRIBUTING.md, anddocs/. - Mentorship: Assign a buddy for the first two weeks.
- Pair Programming: Schedule a session to work through a small feature or bug fix.
- Shadowing: Have the new engineer shadow a PR review or incident response.
- Feedback Loop: Schedule a 1:1 after the first week to address questions.