Skip to content

Commit 39fa016

Browse files
committed
Merge branch 'main' of github.com:mathiasbynens/dotfiles
* 'main' of github.com:mathiasbynens/dotfiles: .macos: adjust toolbar title rollover delay .gitconfig: Rely on Git v2.28’s `init.defaultBranch` .gitconfig: delete `mpr` alias .gitconfig: show most recent branches first meta: rename main branch .gitconfig: make `git init` default to `main` instead of `master` (mathiasbynens#926) .gitconfig: improve `git p` alias (mathiasbynens#896)
2 parents 72ac86e + ea68bda commit 39fa016

File tree

5 files changed

+71
-41
lines changed

5 files changed

+71
-41
lines changed

.gitconfig

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
[alias]
22

3-
# View abbreviated SHA, description, and history graph of the latest 20 commits
3+
# View abbreviated SHA, description, and history graph of the latest 20 commits.
44
l = log --pretty=oneline -n 20 --graph --abbrev-commit
55

6-
# View the current working tree status using the short format
6+
# View the current working tree status using the short format.
77
s = status -s
88

9-
# Show the diff between the latest commit and the current state
9+
# Show the diff between the latest commit and the current state.
1010
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
1111

12-
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
12+
# `git di $number` shows the diff between the state `$number` revisions ago and the current state.
1313
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
1414

15-
# Pull in remote changes for the current repository and all its submodules
16-
p = git pull --recurse-submodules
15+
# Pull in remote changes for the current repository and all its submodules.
16+
p = pull --recurse-submodules
1717

18-
# Clone a repository including all submodules
18+
# Clone a repository including all submodules.
1919
c = clone --recursive
2020

21-
# Commit all changes
21+
# Commit all changes.
2222
ca = !git add -A && git commit -av
2323

24-
# Switch to a branch, creating it if necessary
24+
# Switch to a branch, creating it if necessary.
2525
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
2626

2727
# Show verbose output about tags, branches or remotes
2828
tags = tag -l
29-
branches = branch -a
30-
remotes = remote -v
29+
branches = branch --all
30+
remotes = remote --verbose
3131

32-
# List aliases
32+
# List aliases.
3333
aliases = config --get-regexp alias
3434

35-
# Amend the currently staged files to the latest commit
35+
# Amend the currently staged files to the latest commit.
3636
amend = commit --amend --reuse-message=HEAD
3737

38-
# Credit an author on the latest commit
38+
# Credit an author on the latest commit.
3939
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
4040

41-
# Interactive rebase with the given number of latest commits
41+
# Interactive rebase with the given number of latest commits.
4242
reb = "!r() { git rebase -i HEAD~$1; }; r"
4343

4444
# Remove the old tag with this name and tag the latest commit with it.
@@ -56,49 +56,38 @@
5656
# Find commits by commit message
5757
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"
5858

59-
# Remove branches that have already been merged with master
59+
# Remove branches that have already been merged with main.
6060
# a.k.a. ‘delete merged’
6161
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
6262

63-
# List contributors with number of commits
63+
# List contributors with number of commits.
6464
contributors = shortlog --summary --numbered
6565

66-
# Merge GitHub pull request on top of the current branch or,
67-
# if a branch name is specified, on top of the specified branch
68-
mpr = "!f() { \
69-
declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \
70-
declare branch=\"${2:-$currentBranch}\"; \
71-
if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \
72-
git fetch origin refs/pull/$1/head:pr/$1 && \
73-
git checkout -B $branch && \
74-
git rebase $branch pr/$1 && \
75-
git checkout -B $branch && \
76-
git merge pr/$1 && \
77-
git branch -D pr/$1 && \
78-
git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \
79-
fi \
80-
}; f"
81-
8266
# Show the user email for the current repository.
8367
whoami = config user.email
8468

8569
[apply]
8670

87-
# Detect whitespace errors when applying a patch
71+
# Detect whitespace errors when applying a patch.
8872
whitespace = fix
8973

74+
[branch]
75+
76+
# Show most recently changed branches first.
77+
sort = -committerdate
78+
9079
[core]
9180

92-
# Use custom `.gitignore` and `.gitattributes`
81+
# Use custom `.gitignore` and `.gitattributes`.
9382
excludesfile = ~/.gitignore
9483
attributesfile = ~/.gitattributes
9584

96-
# Treat spaces before tabs and all kinds of trailing whitespace as an error
85+
# Treat spaces before tabs and all kinds of trailing whitespace as an error.
9786
# [default] trailing-space: looks for spaces at the end of a line
9887
# [default] space-before-tab: looks for spaces before tabs at the beginning of a line
9988
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
10089

101-
# Make `git rebase` safer on macOS
90+
# Make `git rebase` safer on macOS.
10291
# More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/>
10392
trustctime = false
10493

@@ -142,12 +131,12 @@
142131

143132
[diff]
144133

145-
# Detect copies as well as renames
134+
# Detect copies as well as renames.
146135
renames = copies
147136

148137
[diff "bin"]
149138

150-
# Use `hexdump` to diff binary files
139+
# Use `hexdump` to diff binary files.
151140
textconv = hexdump -v -C
152141

153142
[diff "bin"]
@@ -156,7 +145,7 @@
156145

157146
[help]
158147

159-
# Automatically correct and execute mistyped commands
148+
# Automatically correct and execute mistyped commands.
160149
autocorrect = 1
161150

162151
[merge]
@@ -192,3 +181,7 @@
192181
[url "git://gist.github.com/"]
193182

194183
insteadOf = "gist:"
184+
185+
[init]
186+
187+
defaultBranch = main

.macos

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ defaults write NSGlobalDomain AppleShowScrollBars -string "Always"
4141
# Disable the over-the-top focus ring animation
4242
defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false
4343

44+
# Adjust toolbar title rollover delay
45+
defaults write NSGlobalDomain NSToolbarTitleViewRolloverDelay -float 0
46+
4447
# Disable smooth scrolling
4548
# (Uncomment if you’re on an older Mac that messes up the animation)
4649
#defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false

.osx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# 301 https://github.com/mathiasbynens/dotfiles/blob/main/.macos

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
This fork of [Mathias Bynens dotfiles](https://github.com/mathiasbynens/dotfiles) is a custom dotfiles build tailored to my preferences of a OS X development machine. Suggestions or hacks that are more effective are welcome.
44

55
## Installation
6+
7+
**Warning:** If you want to give these dotfiles a try, you should first fork this repository, review the code, and remove things you don’t want or need. Don’t blindly use my settings unless you know what that entails. Use at your own risk!
8+
69
### Using Git and the bootstrap script
710

811
You can clone the repository wherever you want. (I like to keep it in `~/Projects/dotfiles`, with `~/dotfiles` as a symlink.) The bootstrapper script will pull in the latest version and copy the files to your home folder.
@@ -33,6 +36,35 @@ cd; curl -#L https://github.com/SaifurRahmanMohsin/dotfiles/tarball/master | tar
3336

3437
To update later on, just run that command again.
3538

39+
### Specify the `$PATH`
40+
41+
If `~/.path` exists, it will be sourced along with the other files, before any feature testing (such as [detecting which version of `ls` is being used](https://github.com/mathiasbynens/dotfiles/blob/aff769fd75225d8f2e481185a71d5e05b76002dc/.aliases#L21-L26)) takes place.
42+
43+
Here’s an example `~/.path` file that adds `/usr/local/bin` to the `$PATH`:
44+
45+
```bash
46+
export PATH="/usr/local/bin:$PATH"
47+
```
48+
49+
### Add custom commands without creating a new fork
50+
51+
If `~/.extra` exists, it will be sourced along with the other files. You can use this to add a few custom commands without the need to fork this entire repository, or to add commands you don’t want to commit to a public repository.
52+
53+
My `~/.extra` looks something like this:
54+
55+
```bash
56+
# Git credentials
57+
# Not in the repository, to prevent people from accidentally committing under my name
58+
GIT_AUTHOR_NAME="Mathias Bynens"
59+
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
60+
git config --global user.name "$GIT_AUTHOR_NAME"
61+
GIT_AUTHOR_EMAIL="[email protected]"
62+
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
63+
git config --global user.email "$GIT_AUTHOR_EMAIL"
64+
```
65+
66+
You could also use `~/.extra` to override settings, functions and aliases from my dotfiles repository. It’s probably better to [fork this repository](https://github.com/mathiasbynens/dotfiles/fork) instead, though.
67+
3668
### Sensible macOS defaults
3769

3870
When setting up a new Mac, you may want to set some sensible macOS defaults:
@@ -48,3 +80,4 @@ When setting up a new Mac, you may want to install some common [Homebrew](https:
4880
```bash
4981
./brew.sh
5082
```
83+

bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
cd "$(dirname "${BASH_SOURCE}")";
44

5-
git pull origin master;
5+
git pull origin main;
66

77
function doIt() {
88
rsync --exclude ".git/" \

0 commit comments

Comments
 (0)