Git Configuration
Table of Contents
- Introduction
- Getting Started with Git
- Setting Up Your Development Environment
- Basic Git Operations
- Creating Your First Pull Request
- Advanced Git Workflow for Aide
- Advanced Git Commands and Techniques
- Resolving Merge Conflicts
- Code Review Process
- Continuous Integration and GitHub Actions
- Best Practices for Aide Development
- Troubleshooting
- Contributing to Aide's Documentation
- Further Reading and Resources
Introduction
Welcome to the comprehensive Git guide for Aide! This document is designed to help contributors of all experience levels work effectively with the Aide project. Whether you're new to Git or an experienced developer, you'll find valuable information to help you contribute to Aide, a powerful web extension that enhances browsing experiences with AI-powered features.
Getting Started with Git
First-Time Git Setup
- Install Git from the official website (opens in a new tab).
- Configure your Git identity:
git config --global user.name "Your Name" git config --global user.email "youremail@example.com"
- Set your preferred editor:
git config --global core.editor "code --wait" # for Visual Studio Code
- (Optional) Set up SSH for GitHub:
- Generate an SSH key:
ssh-keygen -t ed25519 -C "your_email@example.com"
- Add the SSH key to your GitHub account: GitHub SSH setup guide (opens in a new tab)
- Generate an SSH key:
Forking and Cloning the Aide Repository
- Go to the Aide GitHub repository (opens in a new tab).
- Click the "Fork" button to create your own copy of the repository.
- Clone your fork locally:
git clone https://github.com/your-username/aide.git cd aide
- Add the original Aide repository as an upstream remote:
git remote add upstream https://github.com/somritdasgupta/aide.git
Setting Up Your Development Environment
- Install Node.js (v18 or higher) from the official website (opens in a new tab).
- Install project dependencies:
npm install
- Install Ollama (Local AI Provider) following the official guide (opens in a new tab).
Basic Git Operations
Checking Status
git status
Making Changes
- Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name
- Make your changes in your preferred code editor.
Committing Changes
- Stage your changes:
git add .
- Commit with a descriptive message:
git commit -m "Add image recognition feature to sidebar"
Pushing to Your Fork
git push origin feature/your-feature-name
Creating Your First Pull Request
- Go to your fork on GitHub.
- Click "Compare & pull request" next to your recently pushed branch.
- Fill out the pull request template with a detailed description of your changes.
- Submit the pull request for review.
Advanced Git Workflow for Aide
Branching Strategy
main
: The primary branch containing the stable version of Aide.feature/*
: For new features.bugfix/*
: For bug fixes.release/*
: For preparing new releases.
Keeping Your Fork Updated
git fetch upstream
git checkout main
git merge upstream/main
git push origin main
Advanced Git Commands and Techniques
Interactive Rebase
Clean up your commits before submitting a PR:
git rebase -i HEAD~<number of commits>
Cherry-Picking
Apply specific commits from one branch to another:
git cherry-pick <commit-hash>
Stashing Changes
Temporarily store changes:
git stash
git stash pop
Tagging Releases
git tag -a v1.0.0 -m "Release version 1.0.0"
git push origin v1.0.0
Resolving Merge Conflicts
- Update your branch with the latest main:
git checkout main git pull upstream main git checkout your-branch git merge main
- Resolve conflicts manually in your code editor.
- Stage the resolved files:
git add <resolved-files>
- Complete the merge:
git commit
Code Review Process
- Respond to reviewer comments promptly.
- Make requested changes in new commits.
- Push updates to your branch; the PR will update automatically.
- Use "Request review" when you're ready for another look.
Continuous Integration and GitHub Actions
- Aide uses GitHub Actions for CI/CD.
- Ensure your changes pass all automated checks.
- Review the
.github/workflows
directory to understand the CI process.
Best Practices for Aide Development
- Follow the existing code style and use ESLint/Prettier.
- Write clear, concise commit messages.
- Keep pull requests focused on a single feature or fix.
- Update documentation alongside code changes.
- Add or update tests for your changes.
Troubleshooting
Common Issues for Beginners
- "Permission denied" when pushing: Ensure you're pushing to your fork, not the main Aide repository.
- Changes not showing up: Check if you're on the correct branch with
git branch
.
Advanced Troubleshooting
- Recovering lost commits: Use
git reflog
to find and restore lost commits. - Debugging Git issues: Use
git log
,git show
, andgit diff
for investigation.
Contributing to Aide's Documentation
- Documentation lives in the
docs/
directory. - Follow the same PR process for documentation changes.
- Use clear, concise language and provide examples where possible.