Reading list #6

Git

Slightly long form git education

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 executed git 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.

Source