Git is a distributed version control system that tracks changes in source code during software development, enabling collaboration among multiple developers.
Git helps manage code changes by:
- Tracking file changes over time
- Supporting branching and merging
- Enabling distributed development
- Providing a complete history of changes
- Facilitating collaboration among team members
- Supporting workflows for code review and quality control
- Integrating with CI/CD pipelines and other development tools
Git is a core tool that should be installed globally on your system:
# macOS (using Homebrew)
brew install git
# Ubuntu/Debian
sudo apt-get install git
# Windows
# Download from https://git-scm.com/download/winVerify your installation:
git --versionIn this project, Git is used to:
- Track changes to source code and documentation
- Manage feature development through branches
- Facilitate code reviews through pull requests
- Integrate with pre-commit hooks for quality control
- Support the CI/CD pipeline
- Maintain a complete history of project development
Git is configured with standard settings and integrates with pre-commit hooks:
# View current configuration
git config --list
# Set up user information (if not already configured)
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"# Initialize a repository
git init
# Clone a repository
git clone https://github.com/username/repository.git
# Check status
git status
# Stage changes
git add filename
git add . # Stage all changes
# Commit changes
git commit -m "Descriptive commit message"
# Push changes to remote
git push origin branch-name
# Pull changes from remote
git pull origin branch-name# Create a new branch
git branch feature-branch
# Switch to a branch
git checkout feature-branch
# Create and switch to a new branch
git checkout -b feature-branch
# Merge a branch
git checkout main
git merge feature-branch
# Delete a branch
git branch -d feature-branch# Start a new feature
git checkout -b new-feature
# Make changes and commit them
git add .
git commit -m "feat: add new feature"
# Push the branch to remote
git push origin new-feature
# Create a pull request (via GitHub/GitLab/etc.)
# After review and approval, merge the pull request
# Update local main branch
git checkout main
git pull origin main
# Delete the feature branch
git branch -d new-feature# Install pre-commit hooks
uv run pre-commit install
# Make changes
# ...
# Stage changes
git add .
# Commit (pre-commit hooks will run automatically)
git commit -m "feat: add new feature"
# If hooks fail, fix issues and try again
git add .
git commit -m "feat: add new feature"This project follows a feature branch workflow:
- Main Branch: The
mainbranch contains stable, production-ready code - Feature Branches: New features are developed in dedicated branches
- Pull Requests: Changes are reviewed through pull requests
- Merge Strategy: Feature branches are merged into
mainafter review - Commit Messages: Follows the Conventional Commits specification
- Write meaningful commit messages: Follow the Conventional Commits specification.
- Keep commits focused: Each commit should represent a single logical change.
- Pull before pushing: Always pull the latest changes before pushing to avoid conflicts.
- Use branches for features: Develop new features in dedicated branches.
- Review code before merging: Use pull requests for code review.
- Don't commit sensitive information: Keep secrets, credentials, and personal data out of the repository.
- Use .gitignore: Properly configure
.gitignoreto exclude unnecessary files.
- Create a feature branch from
main - Develop the feature in the branch
- Create a pull request for review
- Merge the feature branch into
mainafter approval
mainbranch for production releasesdevelopbranch for development- Feature branches for new features
- Release branches for preparing releases
- Hotfix branches for urgent fixes