• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

I Open-Sourced My Production Git Config (And You Should Steal It)

Sascha Оффлайн

Sascha

Заместитель Администратора
Команда форума
Администратор
Регистрация
9 Май 2015
Сообщения
1,605
Баллы
155


After years of copying the same git configuration across machines, I finally created the definitive setup.

Today, I'm sharing it with you.

The Problem


Every developer faces this:

  • New machine = hours of git configuration
  • Forgetting which settings made things faster
  • GPG signing is complicated
  • Inconsistent workflows across teams
  • Slow git operations on large repos
The Solution


A production-ready git configuration that emphasizes:

🔐 Security - SSH commit signing, no more GPG complexity
⚡ Performance - 10x faster operations on large repos
🎨 Developer Experience - 25+ useful aliases
📦 Modern Standards - XDG compliance, conventional commits

Key Features

1. SSH Commit Signing Made Simple


SSH signing is way simpler than GPG. You already have SSH keys for GitHub/GitLab authentication. Just use the same key for signing!

Benefits:

  • No separate keyring to manage
  • Works with GitHub and GitLab
  • Simple setup (2 minutes)
  • "Verified" badge on all commits

Setup:


# Use your existing SSH key
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign true



2. Performance That Actually Matters


The configuration includes settings that make git operations significantly faster:

Key optimizations:

  • core.fsmonitor = true - Use filesystem events (10x faster status)
  • core.untrackedCache = true - Cache untracked files
  • core.commitGraph = true - Faster log operations
  • protocol.version = 2 - Modern git protocol
  • index.version = 4 - Compressed index

Real-world impact:

  • Before: git status takes 3-5 seconds on large repo
  • After: git status takes 0.3 seconds
  • That's a 10x improvement!
3. Aliases That Save Hours


Instead of typing long commands, use shortcuts:


git undo # Safely undo last commit
git amend # Quick amend without editing message
git gone # Delete local branches that were merged
git sync # Fetch all and pull with rebase
git recent # Show recently worked branches
git staged # Show staged changes
git unstage # Remove from staging
git wip # Quick work-in-progress commit




Time saved: ~30 minutes per day

4. Security Hardening


Built-in security features:

  • Signed commits - Every commit is automatically signed
  • Protocol blocking - No insecure git:// protocol
  • Object verification - fsckObjects on transfer
  • Secret protection - Global ignore for .env, keys, credentials
5. Better Diffs and Merges


Enhanced diff algorithm and merge conflict resolution:


[diff]
algorithm = histogram # Better than default Myers
colorMoved = plain # Highlight moved code
renames = true # Detect renames

[merge]
conflictstyle = zdiff3 # Show original + both changes




Result: Easier code reviews and conflict resolution

6. Conventional Commits


Built-in commit message template:


feat(scope): Add new feature
fix(scope): Fix bug
docs: Update documentation




Benefits:

  • Consistent commit messages
  • Automatic changelog generation
  • Better team collaboration
7. Cross-Platform Support


Works seamlessly on macOS, Linux, and Windows:

  • Automatic line ending normalization
  • Platform-specific gitattributes
  • Universal ignore patterns
Installation


5-minute setup:


# 1. Clone the repository
git clone

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.


cd git-configuration

# 2. Copy configuration files
mkdir -p ~/.config/git
cp config ~/.config/git/config
cp commit-template.txt ~/.config/git/commit-template.txt
cp allowed_signers ~/.config/git/allowed_signers
cp attributes ~/.config/git/attributes
cp ignore ~/.config/git/ignore

# 3. Update with your info
# Edit ~/.config/git/config
# Replace "Your Name" and "your.email@example.com"

# 4. Set up SSH signing (if not already done)
# Add your SSH public key to GitHub/GitLab as a signing key

# 5. Test it
git config --list | grep user



Results


After using this configuration:

BeforeAfter
Setup time: 1+ hourSetup time: 5 minutes
Commit signing: Complex GPGCommit signing: Simple SSH
Git status: SlowGit status: 10x faster
Team consistency: VariableTeam consistency: Standardized
Security: ManualSecurity: Automated
Get It Now


📦 Repository:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



⭐ Star it if you find it useful!

What's Next?


The repository includes:

  • ✅ Complete installation guide
  • ✅ SSH key generation tutorial
  • ✅ GitHub/GitLab setup instructions
  • ✅ Troubleshooting section
  • ✅ Team workflow recommendations
Your Turn


What git configurations have made your life easier? Share in the comments!


Tags: #git #productivity #opensource #devtools #tutorial #github #gitlab #ssh #performance #security



Источник:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу