Git
- If you’re absolutely new to git, Ibra’s write up is a solid place to get started.
- Scott Spence’s git cheat sheet
- All my notes tagged git
Slightly long form git education
- think like a git: Probably my all time favourite learning resource for git.
- Primeagen git courses on frontendmasters.com
Git clients
Tips & Tricks from Scott Chacon
Setting up an alias
git config --global alias.staash 'stash --all'
- Now when I type
git staash
, this is executedgit stash --all
- fyi,
git stash --all
will also stash untracked files. This is more intuitive I think.
Simpler way to separate git configs for groups of repos
You need to add this to the global git config.
[includeIf "gitdir:~/projects/oss"]
path = ~/.gitconfig-oss
[includeIf "gitdir:~/projects/work"]
path = ~/.gitconfig-work
git branch
sorts branch alphabetically
And that’s not very helpful. You can sort by most recently committed
git config --global branch.sort -committerdate
How to avoid overwriting someone’s work with a force push
git config --global alias.fpush 'push --force-with-lease'
Git will first check if the branch you are force pushing to matches the expected state at the time your local branch was last fetched or pulled.