templates1
This commit is contained in:
120
git-quick-reference.md
Normal file
120
git-quick-reference.md
Normal file
@@ -0,0 +1,120 @@
|
||||
# Git Commands Quick Reference Card
|
||||
|
||||
## Essential Daily Commands
|
||||
|
||||
### Starting Your Work Session
|
||||
```bash
|
||||
git status # Check current repository state
|
||||
git pull origin main # Get latest changes from remote
|
||||
git checkout -b feature/name # Create and switch to new branch
|
||||
```
|
||||
|
||||
### During Development
|
||||
```bash
|
||||
git status # Check what files have changed
|
||||
git diff # See what changes you've made
|
||||
git add filename # Stage specific file
|
||||
git add . # Stage all changes
|
||||
git commit -m "message" # Save changes with description
|
||||
git push origin branch-name # Backup your work to remote
|
||||
```
|
||||
|
||||
### Completing a Feature
|
||||
```bash
|
||||
git checkout main # Switch back to main branch
|
||||
git pull origin main # Get latest changes
|
||||
git merge feature/name # Merge your feature
|
||||
git push origin main # Push completed feature
|
||||
git branch -d feature/name # Delete local feature branch
|
||||
```
|
||||
|
||||
### Emergency Commands
|
||||
```bash
|
||||
git stash # Temporarily save uncommitted work
|
||||
git stash pop # Restore stashed work
|
||||
git reset --soft HEAD~1 # Undo last commit, keep changes
|
||||
git checkout -- filename # Discard changes to specific file
|
||||
```
|
||||
|
||||
### Information Commands
|
||||
```bash
|
||||
git log --oneline # View commit history
|
||||
git branch -a # See all branches
|
||||
git remote -v # See remote repositories
|
||||
git diff HEAD~1 # Compare with previous commit
|
||||
```
|
||||
|
||||
## Commit Message Best Practices
|
||||
|
||||
### Good Examples:
|
||||
- `Add user authentication system`
|
||||
- `Fix login validation bug`
|
||||
- `Update README with installation steps`
|
||||
- `Refactor database connection logic`
|
||||
|
||||
### Bad Examples:
|
||||
- `fixed stuff`
|
||||
- `updates`
|
||||
- `asdf`
|
||||
- `commit`
|
||||
|
||||
### Conventional Commit Format:
|
||||
- `feat: add user registration`
|
||||
- `fix: resolve login timeout issue`
|
||||
- `docs: update API documentation`
|
||||
- `style: format code with prettier`
|
||||
|
||||
## File Naming Conventions
|
||||
|
||||
### Repository Names:
|
||||
- Use lowercase letters
|
||||
- Use hyphens instead of spaces
|
||||
- Be descriptive but concise
|
||||
- Examples: `user-management-system`, `blog-website`, `data-analysis-tools`
|
||||
|
||||
### Branch Names:
|
||||
- `feature/add-user-auth`
|
||||
- `bugfix/fix-login-error`
|
||||
- `docs/update-readme`
|
||||
- `hotfix/critical-security-patch`
|
||||
|
||||
### File Names:
|
||||
- Use meaningful names
|
||||
- Follow language conventions
|
||||
- Examples: `user_controller.py`, `LoginForm.js`, `database-schema.sql`
|
||||
|
||||
## Common Git Patterns
|
||||
|
||||
### Feature Development Workflow:
|
||||
```
|
||||
main branch
|
||||
↓
|
||||
feature branch (work here)
|
||||
↓
|
||||
merge back to main
|
||||
↓
|
||||
delete feature branch
|
||||
```
|
||||
|
||||
### Daily Routine:
|
||||
```
|
||||
Morning: git pull origin main
|
||||
Work: edit → add → commit → push (repeat)
|
||||
Evening: merge completed features to main
|
||||
```
|
||||
|
||||
### Project Structure:
|
||||
```
|
||||
my-project/
|
||||
├── README.md
|
||||
├── .gitignore
|
||||
├── LICENSE
|
||||
├── CHANGELOG.md
|
||||
├── src/
|
||||
│ ├── main.py
|
||||
│ └── utils.py
|
||||
├── docs/
|
||||
│ └── setup.md
|
||||
└── tests/
|
||||
└── test_main.py
|
||||
```
|
||||
542
gitea_setup.md
Normal file
542
gitea_setup.md
Normal file
@@ -0,0 +1,542 @@
|
||||
# Complete Gitea Setup Guide for Beginners
|
||||
|
||||
## A) Initial Setup of Gitea on Computer
|
||||
|
||||
### 1. Install Git on Your Computer
|
||||
|
||||
**Windows:**
|
||||
- Download Git from https://git-scm.com/download/win
|
||||
- Run installer with default settings
|
||||
- Open Git Bash or Command Prompt
|
||||
|
||||
**macOS:**
|
||||
- Install via Homebrew: `brew install git`
|
||||
- Or download from https://git-scm.com/download/mac
|
||||
|
||||
**Linux (Ubuntu/Debian):**
|
||||
- Install via package manager: `sudo apt-get install git`
|
||||
|
||||
### 2. Verify Git Installation
|
||||
```bash
|
||||
git --version
|
||||
```
|
||||
|
||||
### 3. Connect Computer to Your Existing Codebase/Folder
|
||||
|
||||
**Option 1: Connect Existing Local Folder to Gitea**
|
||||
```bash
|
||||
cd /path/to/your/existing/project
|
||||
git init
|
||||
git remote add origin git@your-gitea-server:username/repository-name.git
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
git push -u origin main
|
||||
```
|
||||
|
||||
**Option 2: Clone Existing Repository from Gitea**
|
||||
```bash
|
||||
git clone git@your-gitea-server:username/repository-name.git
|
||||
cd repository-name
|
||||
```
|
||||
|
||||
## B) Initial Configuration on New Computer
|
||||
|
||||
### 1. Configure Git Identity
|
||||
```bash
|
||||
git config --global user.name "Your Full Name"
|
||||
git config --global user.email "your.email@example.com"
|
||||
git config --global core.editor "nano" # or "code" for VS Code
|
||||
git config --global color.ui true
|
||||
```
|
||||
|
||||
### 2. Generate SSH Key for Secure Authentication
|
||||
```bash
|
||||
# Generate new SSH key
|
||||
ssh-keygen -t ed25519 -C "your.email@example.com"
|
||||
|
||||
# Start SSH agent
|
||||
eval "$(ssh-agent -s)"
|
||||
|
||||
# Add key to agent
|
||||
ssh-add ~/.ssh/id_ed25519
|
||||
|
||||
# Display public key to copy to Gitea
|
||||
cat ~/.ssh/id_ed25519.pub
|
||||
```
|
||||
|
||||
### 3. Add SSH Key to Gitea Account
|
||||
1. Copy the public key output from above
|
||||
2. Log into Gitea web interface
|
||||
3. Go to Settings > SSH/GPG Keys
|
||||
4. Click "Add Key"
|
||||
5. Paste public key in Content field
|
||||
6. Click "Add Key"
|
||||
|
||||
### 4. Test SSH Connection
|
||||
```bash
|
||||
ssh -T git@your-gitea-server.com
|
||||
```
|
||||
You should see a success message.
|
||||
|
||||
### 5. Set Up Git Aliases (Optional but Helpful)
|
||||
```bash
|
||||
git config --global alias.st status
|
||||
git config --global alias.co checkout
|
||||
git config --global alias.br branch
|
||||
git config --global alias.ci commit
|
||||
git config --global alias.lg "log --oneline --graph --decorate"
|
||||
```
|
||||
|
||||
## C) Steps to Form a New Project Each Time
|
||||
|
||||
### 1. Create Repository in Gitea Web Interface
|
||||
1. Log into Gitea
|
||||
2. Click "+" menu in top-right corner
|
||||
3. Select "New Repository"
|
||||
4. Fill out repository details:
|
||||
- **Repository Name:** use-lowercase-with-hyphens
|
||||
- **Description:** Brief project description
|
||||
- **Visibility:** Public or Private
|
||||
- **Initialize Repository:** Check if starting fresh
|
||||
- **Add .gitignore:** Select template for your language
|
||||
- **Add License:** Choose appropriate license
|
||||
5. Click "Create Repository"
|
||||
|
||||
### 2. Clone and Set Up Locally
|
||||
```bash
|
||||
# Clone the new repository
|
||||
git clone git@your-gitea-server:username/repository-name.git
|
||||
|
||||
# Navigate to project directory
|
||||
cd repository-name
|
||||
|
||||
# Create basic project structure
|
||||
mkdir src docs tests
|
||||
touch src/main.py # or main.js, main.cpp, etc.
|
||||
|
||||
# Add initial files
|
||||
git add .
|
||||
git commit -m "Initial project structure"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
### 3. Create Development Branch
|
||||
```bash
|
||||
# Create and switch to development branch
|
||||
git checkout -b develop
|
||||
|
||||
# Push development branch to remote
|
||||
git push -u origin develop
|
||||
```
|
||||
|
||||
## D) Templates and Documents for New Setup
|
||||
|
||||
### 1. Essential Files Every Repository Should Have
|
||||
|
||||
#### README.md Template
|
||||
```markdown
|
||||
# Project Name
|
||||
|
||||
Brief description of what this project does.
|
||||
|
||||
## Features
|
||||
- Feature 1
|
||||
- Feature 2
|
||||
- Feature 3
|
||||
|
||||
## Installation
|
||||
```bash
|
||||
git clone git@your-gitea-server:username/project-name.git
|
||||
cd project-name
|
||||
# Add installation steps
|
||||
```
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
# Add usage examples
|
||||
```
|
||||
|
||||
## Configuration
|
||||
Describe any configuration needed.
|
||||
|
||||
## Contributing
|
||||
Guidelines for contributing to the project.
|
||||
|
||||
## License
|
||||
This project is licensed under the [License Name](LICENSE) - see the LICENSE file for details.
|
||||
```
|
||||
|
||||
#### .gitignore Template (General)
|
||||
```
|
||||
# Operating System Files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Editor Files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# Log Files
|
||||
*.log
|
||||
logs/
|
||||
|
||||
# Environment Files
|
||||
.env
|
||||
.env.local
|
||||
.env.production
|
||||
*.secret
|
||||
|
||||
# Temporary Files
|
||||
*.tmp
|
||||
*.temp
|
||||
temp/
|
||||
tmp/
|
||||
|
||||
# Build Files
|
||||
dist/
|
||||
build/
|
||||
*.o
|
||||
*.exe
|
||||
```
|
||||
|
||||
#### LICENSE Template (MIT)
|
||||
```
|
||||
MIT License
|
||||
|
||||
Copyright (c) [year] [fullname]
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
```
|
||||
|
||||
#### CHANGELOG.md Template
|
||||
```markdown
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- New features
|
||||
|
||||
### Changed
|
||||
- Changes in existing functionality
|
||||
|
||||
### Deprecated
|
||||
- Soon-to-be removed features
|
||||
|
||||
### Removed
|
||||
- Removed features
|
||||
|
||||
### Fixed
|
||||
- Bug fixes
|
||||
|
||||
### Security
|
||||
- Security improvements
|
||||
|
||||
## [1.0.0] - 2024-01-01
|
||||
### Added
|
||||
- Initial release
|
||||
```
|
||||
|
||||
### 2. Gitea-Specific Templates
|
||||
|
||||
#### Issue Template (.gitea/ISSUE_TEMPLATE.md)
|
||||
```markdown
|
||||
## Bug Description
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
## Steps to Reproduce
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
## Expected Behavior
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
## Screenshots
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
## Environment
|
||||
- OS: [e.g. Windows 10, macOS 12, Ubuntu 20.04]
|
||||
- Version: [e.g. 1.2.3]
|
||||
- Browser: [e.g. Chrome 96, Firefox 95]
|
||||
|
||||
## Additional Context
|
||||
Add any other context about the problem here.
|
||||
```
|
||||
|
||||
#### Pull Request Template (.gitea/PULL_REQUEST_TEMPLATE.md)
|
||||
```markdown
|
||||
## Description
|
||||
Brief description of changes made.
|
||||
|
||||
## Type of Change
|
||||
- [ ] Bug fix
|
||||
- [ ] New feature
|
||||
- [ ] Documentation update
|
||||
- [ ] Performance improvement
|
||||
- [ ] Code refactoring
|
||||
|
||||
## Testing
|
||||
- [ ] I have tested this change locally
|
||||
- [ ] I have added/updated tests as needed
|
||||
- [ ] All existing tests pass
|
||||
|
||||
## Checklist
|
||||
- [ ] My code follows the project's style guidelines
|
||||
- [ ] I have performed a self-review of my own code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] My changes generate no new warnings
|
||||
```
|
||||
|
||||
## E) Very Detailed Daily Coding Workflow
|
||||
|
||||
### 1. Start of Each Work Session
|
||||
```bash
|
||||
# Check current status
|
||||
git status
|
||||
|
||||
# Get latest changes from remote
|
||||
git pull origin main
|
||||
|
||||
# Create new feature branch (use descriptive names)
|
||||
git checkout -b feature/add-user-authentication
|
||||
# or
|
||||
git checkout -b bugfix/fix-login-error
|
||||
# or
|
||||
git checkout -b docs/update-readme
|
||||
```
|
||||
|
||||
### 2. During Development
|
||||
|
||||
#### Making Changes
|
||||
```bash
|
||||
# Check what files have changed
|
||||
git status
|
||||
|
||||
# See specific changes in files
|
||||
git diff
|
||||
|
||||
# See changes for specific file
|
||||
git diff filename.py
|
||||
```
|
||||
|
||||
#### Staging and Committing Changes
|
||||
```bash
|
||||
# Stage specific files
|
||||
git add src/auth.py src/login.py
|
||||
|
||||
# Or stage all changes
|
||||
git add .
|
||||
|
||||
# Or stage all changes in current directory
|
||||
git add -A
|
||||
|
||||
# Check what's staged
|
||||
git status
|
||||
|
||||
# Commit with descriptive message
|
||||
git commit -m "Add user authentication with email verification"
|
||||
|
||||
# Or commit with detailed message
|
||||
git commit -m "Add user authentication system
|
||||
|
||||
- Implement email-based user registration
|
||||
- Add password hashing with bcrypt
|
||||
- Create login/logout functionality
|
||||
- Add session management
|
||||
- Include email verification workflow
|
||||
|
||||
Fixes #123"
|
||||
```
|
||||
|
||||
#### Best Practices for Commit Messages
|
||||
- Use present tense imperative mood ("Add feature" not "Added feature")
|
||||
- Keep first line under 50 characters
|
||||
- Add blank line before detailed description
|
||||
- Reference issue numbers when applicable
|
||||
- Use conventional commit format:
|
||||
- `feat:` for new features
|
||||
- `fix:` for bug fixes
|
||||
- `docs:` for documentation
|
||||
- `style:` for formatting changes
|
||||
- `refactor:` for code refactoring
|
||||
- `test:` for adding tests
|
||||
|
||||
#### Pushing Changes
|
||||
```bash
|
||||
# Push current branch to remote
|
||||
git push origin feature/add-user-authentication
|
||||
|
||||
# If first time pushing this branch
|
||||
git push -u origin feature/add-user-authentication
|
||||
```
|
||||
|
||||
### 3. Checking Progress and History
|
||||
```bash
|
||||
# View commit history
|
||||
git log --oneline
|
||||
|
||||
# View detailed history
|
||||
git log --graph --decorate --oneline
|
||||
|
||||
# View changes between commits
|
||||
git log -p
|
||||
|
||||
# View specific file history
|
||||
git log --follow filename.py
|
||||
|
||||
# View who changed what in a file
|
||||
git blame filename.py
|
||||
```
|
||||
|
||||
### 4. Handling Merge Conflicts
|
||||
```bash
|
||||
# If pull/merge results in conflicts
|
||||
git status # Shows conflicted files
|
||||
|
||||
# Edit conflicted files manually, looking for:
|
||||
# <<<<<<< HEAD
|
||||
# Your changes
|
||||
# =======
|
||||
# Their changes
|
||||
# >>>>>>> branch-name
|
||||
|
||||
# After resolving conflicts
|
||||
git add conflicted-file.py
|
||||
git commit -m "Resolve merge conflict in user authentication"
|
||||
```
|
||||
|
||||
### 5. End of Feature Development
|
||||
```bash
|
||||
# Switch back to main branch
|
||||
git checkout main
|
||||
|
||||
# Get latest changes
|
||||
git pull origin main
|
||||
|
||||
# Merge feature branch
|
||||
git merge feature/add-user-authentication
|
||||
|
||||
# Push merged changes
|
||||
git push origin main
|
||||
|
||||
# Delete feature branch locally
|
||||
git branch -d feature/add-user-authentication
|
||||
|
||||
# Delete feature branch on remote
|
||||
git push origin --delete feature/add-user-authentication
|
||||
```
|
||||
|
||||
### 6. Daily Maintenance Commands
|
||||
```bash
|
||||
# See all branches (local and remote)
|
||||
git branch -a
|
||||
|
||||
# See remote repositories
|
||||
git remote -v
|
||||
|
||||
# Clean up remote tracking branches
|
||||
git remote prune origin
|
||||
|
||||
# See repository status
|
||||
git status
|
||||
|
||||
# See what's different from last commit
|
||||
git diff HEAD~1
|
||||
|
||||
# Undo last commit (but keep changes)
|
||||
git reset --soft HEAD~1
|
||||
|
||||
# Undo changes to a file
|
||||
git checkout -- filename.py
|
||||
|
||||
# Create and apply patches
|
||||
git format-patch -1 HEAD
|
||||
git apply patch-file.patch
|
||||
```
|
||||
|
||||
### 7. Working with Multiple Remotes
|
||||
```bash
|
||||
# Add additional remote (e.g., for backup)
|
||||
git remote add backup git@backup-server:username/repository.git
|
||||
|
||||
# Push to specific remote
|
||||
git push backup main
|
||||
|
||||
# Pull from specific remote
|
||||
git pull backup main
|
||||
```
|
||||
|
||||
### 8. Stashing Work in Progress
|
||||
```bash
|
||||
# Save current work without committing
|
||||
git stash push -m "Work in progress on authentication"
|
||||
|
||||
# List stashes
|
||||
git stash list
|
||||
|
||||
# Apply most recent stash
|
||||
git stash pop
|
||||
|
||||
# Apply specific stash
|
||||
git stash apply stash@{1}
|
||||
|
||||
# Drop a stash
|
||||
git stash drop stash@{1}
|
||||
```
|
||||
|
||||
### 9. Emergency Procedures
|
||||
|
||||
#### Undo Last Commit
|
||||
```bash
|
||||
# Undo last commit but keep changes
|
||||
git reset --soft HEAD~1
|
||||
|
||||
# Undo last commit and lose changes
|
||||
git reset --hard HEAD~1
|
||||
```
|
||||
|
||||
#### Recovery
|
||||
```bash
|
||||
# Find lost commits
|
||||
git reflog
|
||||
|
||||
# Recover specific commit
|
||||
git checkout commit-hash
|
||||
|
||||
# Create branch from recovered commit
|
||||
git checkout -b recovery-branch
|
||||
```
|
||||
|
||||
This comprehensive guide provides everything needed to effectively use Git with Gitea for personal coding projects.
|
||||
574
gitignore-templates.md
Normal file
574
gitignore-templates.md
Normal file
@@ -0,0 +1,574 @@
|
||||
# .gitignore Templates for Common Programming Languages
|
||||
|
||||
## Universal .gitignore (Good for any project)
|
||||
```gitignore
|
||||
# Operating System Files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Editor Files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
.project
|
||||
.classpath
|
||||
.settings/
|
||||
|
||||
# Log Files
|
||||
*.log
|
||||
logs/
|
||||
log/
|
||||
|
||||
# Environment Files
|
||||
.env
|
||||
.env.local
|
||||
.env.development
|
||||
.env.test
|
||||
.env.production
|
||||
.env.staging
|
||||
*.secret
|
||||
config.local.js
|
||||
|
||||
# Temporary Files
|
||||
*.tmp
|
||||
*.temp
|
||||
temp/
|
||||
tmp/
|
||||
*.bak
|
||||
*.backup
|
||||
|
||||
# Archive Files
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
*.7z
|
||||
|
||||
# System Files
|
||||
desktop.ini
|
||||
```
|
||||
|
||||
## Python Projects
|
||||
```gitignore
|
||||
# Universal files first (copy from above)
|
||||
|
||||
# Python-specific
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# Virtual environments
|
||||
venv/
|
||||
env/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
.virtualenv
|
||||
|
||||
# Conda
|
||||
.conda/
|
||||
|
||||
# Django
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Celery
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
```
|
||||
|
||||
## JavaScript/Node.js Projects
|
||||
```gitignore
|
||||
# Universal files first (copy from above)
|
||||
|
||||
# Dependencies
|
||||
node_modules/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage/
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# parcel-bundler cache
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
public
|
||||
|
||||
# Storybook build outputs
|
||||
.out
|
||||
.storybook-out
|
||||
|
||||
# Temporary folders
|
||||
.tmp
|
||||
|
||||
# React
|
||||
build/
|
||||
|
||||
# Vue.js
|
||||
dist/
|
||||
|
||||
# Webpack
|
||||
.webpack/
|
||||
|
||||
# Babel
|
||||
.babel_cache/
|
||||
```
|
||||
|
||||
## Java Projects
|
||||
```gitignore
|
||||
# Universal files first (copy from above)
|
||||
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs
|
||||
hs_err_pid*
|
||||
|
||||
# Maven
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
# Gradle
|
||||
.gradle
|
||||
build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
# IntelliJ IDEA
|
||||
.idea/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
# Eclipse
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
# NetBeans
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
# VS Code
|
||||
.vscode/
|
||||
|
||||
# Spring Boot
|
||||
spring-boot-*.log
|
||||
```
|
||||
|
||||
## C/C++ Projects
|
||||
```gitignore
|
||||
# Universal files first (copy from above)
|
||||
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
# CMake
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
|
||||
# Build directories
|
||||
build/
|
||||
debug/
|
||||
release/
|
||||
```
|
||||
|
||||
## Go Projects
|
||||
```gitignore
|
||||
# Universal files first (copy from above)
|
||||
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool
|
||||
*.out
|
||||
|
||||
# Dependency directories
|
||||
vendor/
|
||||
|
||||
# Go workspace file
|
||||
go.work
|
||||
go.work.sum
|
||||
|
||||
# Build output
|
||||
bin/
|
||||
pkg/
|
||||
dist/
|
||||
|
||||
# Air (live reload)
|
||||
tmp/
|
||||
|
||||
# GoLand
|
||||
.idea/
|
||||
|
||||
# VS Code Go extension
|
||||
.vscode/
|
||||
```
|
||||
|
||||
## Web Development (HTML/CSS/JS)
|
||||
```gitignore
|
||||
# Universal files first (copy from above)
|
||||
|
||||
# Sass
|
||||
.sass-cache/
|
||||
*.css.map
|
||||
*.sass.map
|
||||
*.scss.map
|
||||
|
||||
# Less
|
||||
*.css.map
|
||||
|
||||
# Bundle files
|
||||
bundle.js
|
||||
bundle.css
|
||||
|
||||
# Compiled CSS from preprocessors
|
||||
*.compiled.css
|
||||
|
||||
# npm/yarn
|
||||
node_modules/
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
|
||||
# Webpack
|
||||
dist/
|
||||
.webpack/
|
||||
|
||||
# Parcel
|
||||
.cache/
|
||||
.parcel-cache/
|
||||
|
||||
# Build tools
|
||||
.grunt/
|
||||
.gulp/
|
||||
|
||||
# Static site generators
|
||||
_site/
|
||||
.jekyll-cache/
|
||||
.jekyll-metadata
|
||||
|
||||
# PWA
|
||||
sw.js
|
||||
workbox-*.js
|
||||
```
|
||||
|
||||
## Docker Projects
|
||||
```gitignore
|
||||
# Universal files first (copy from above)
|
||||
|
||||
# Docker
|
||||
.dockerignore
|
||||
docker-compose.override.yml
|
||||
.docker/
|
||||
|
||||
# Container runtime files
|
||||
*.pid
|
||||
*.log
|
||||
|
||||
# Docker volumes
|
||||
data/
|
||||
volumes/
|
||||
```
|
||||
|
||||
## Recommended Usage Instructions
|
||||
|
||||
1. **Start with Universal**: Always begin with the universal .gitignore section
|
||||
2. **Add Language-Specific**: Append the appropriate language-specific section
|
||||
3. **Customize for Your Project**: Add any project-specific files or directories
|
||||
4. **Keep It Updated**: Review and update your .gitignore as your project evolves
|
||||
|
||||
## Creating .gitignore Files
|
||||
|
||||
### Method 1: Manual Creation
|
||||
```bash
|
||||
# Navigate to your project root
|
||||
cd your-project
|
||||
|
||||
# Create .gitignore file
|
||||
touch .gitignore
|
||||
|
||||
# Edit with your preferred editor
|
||||
nano .gitignore # or code .gitignore for VS Code
|
||||
```
|
||||
|
||||
### Method 2: Use gitignore.io
|
||||
Visit https://gitignore.io and generate custom .gitignore files for your stack.
|
||||
|
||||
### Method 3: GitHub Templates
|
||||
When creating a repository in Gitea, you can initialize with a .gitignore template for common languages.
|
||||
|
||||
## Tips for .gitignore Management
|
||||
|
||||
1. **Add .gitignore early**: Create it before your first commit
|
||||
2. **Test your patterns**: Use `git status` to verify files are being ignored
|
||||
3. **Use comments**: Document why certain patterns are included
|
||||
4. **Be specific**: Avoid overly broad patterns that might exclude needed files
|
||||
5. **Global gitignore**: Consider setting up a global .gitignore for OS-specific files
|
||||
|
||||
### Setting up Global .gitignore
|
||||
```bash
|
||||
# Create global gitignore file
|
||||
git config --global core.excludesfile ~/.gitignore_global
|
||||
|
||||
# Add common files to global ignore
|
||||
echo ".DS_Store" >> ~/.gitignore_global
|
||||
echo "Thumbs.db" >> ~/.gitignore_global
|
||||
echo "*.log" >> ~/.gitignore_global
|
||||
```
|
||||
Reference in New Issue
Block a user