Better defaults for git
https://spin.atomicobject.com/2020/05/05/git-configurations-default/
- Rebase on pull
- Prune on fetch
- Diff with colors to show moves instead of changes
git config --global pull.rebase true
git config --global fetch.prune true
git config --global diff.colorMoved zebra
Submodules
https://www.cyberdemon.org/2024/03/20/submodules.html
git submodule update --init --recursive
Which for Git >= 2.14 can be made automatic with:
git config --global submodule.recurse true
Additional configs
https://kiranrao.ca/2024/06/21/git-config.html
- GPG signing
- Aliases
- Auto setup remote
Tags : best practices
https://blog.aloni.org/posts/proper-use-of-git-tags/
- Limit who can push tags to server repo
- use vXYZ, easier for shell completion
-
- only use annotated tags
- rely on version files, not tags alone
- the commit that changes version file is the one to be tagged
GitHub - synchronize forked repository automatically
https://dev.to/n3wt0n/3-ways-to-sync-a-forked-repository-on-github-automatically-cfd
In GitHub Actions workflow:
- name: Sync and merge upstream repository with your current repository
uses: dabreadman/[email protected]
with:
# URL of gitHub public upstream repo
upstream_repo: "https://github.com/actions/starter-workflows.git"
# Branch to merge from upstream (defaults to downstream branch)
upstream_branch: main
# Branch to merge into downstream
downstream_branch: master
# GitHub Bot token
token: ${{ secrets.GITHUB_TOKEN }}
Internals & performance optimizations
- Git internals
- Performance
- Optimizations for monorepos
Reducing repository size
https://www.jonathancreamer.com/how-we-shrunk-our-git-repo-size-by-94-percent/
- pathwalk
- repack -window
Archiving historical code
Back-dating Git commits
https://til.simonwillison.net/git/backdate-git-commits
git credentials
https://tylercipriani.com/blog/2024/07/31/git-as-a-password-prompt/