Skip to content

Commit

Permalink
remove optional settings from KA gitconfig
Browse files Browse the repository at this point in the history
Summary:
first target for cleaning up dotfiles, opening review now for
discussion.  this one seems pretty straightforward to me, but
some open questions.

First commits:
wip: more consistent name for KA global gitignore

wip: move all optional preferences into separate file
global preferences that are not *essential* to our workflow, and
convenience abbreviations and other cleverness (which could conflict
with user existing settings)

instructions to restore all old prefs are at the top of
.gitconfig.khan-xtra

Test Plan: test in VM, verify rollout with new employees on next Monday cycle

Reviewers: marcos, ethan, csilvers

Reviewed By: csilvers

Subscribers: alpert

Projects: #devenvfixup

Differential Revision: https://phabricator.khanacademy.org/D18665
  • Loading branch information
Matthew Rothenberg committed Jun 19, 2015
1 parent 9ec8f80 commit 9f79cfc
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 39 deletions.
51 changes: 12 additions & 39 deletions .gitconfig.khan
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
[core]
# Global .gitignore file
excludesfile = ~/.gitignore_global

[color]
status = auto
branch = auto
diff = auto
interactive = auto
# KA specific global .gitignore file
excludesfile = ~/.gitignore.khan

[branch]
# autosetupmerge auto-adds the --track flag to each git branch,
Expand All @@ -15,25 +9,7 @@
autosetupmerge = always
autosetuprebase = always

[alias]
# Abbreviations.
st = status
ci = commit
# Show branches (and tags) ordered by last-modified.
br = for-each-ref --sort=-committerdate --format='%(HEAD) %(refname:short)' refs/heads/
tg = for-each-ref --sort=taggerdate --format='%(refname:short)' refs/tags/
df = diff
dfs = diff --staged
lp = log -p
bw = blame -w ; ignore whitespace changes

# Versions of commands with useful options specified.
graph = log --graph --decorate --oneline --pretty=format:"%h%x20%Cgreen%d%x20%Cred%an%x20%Cblue%ad%x20%Creset%s" --all --full-history --date=short
ls-ignored = ls-files --exclude-standard --ignored --others
conflicts = diff --name-only --diff-filter=U

# Versions of commands that handle submodules properly.
# TODO(dmnd): Move to ./bin
co = "!f() { git checkout \"$@\" && git submodule update --init --recursive; }; f"
p = "!f() { git pull \"$@\" && git submodule update --init --recursive; }; f"
m = "!f() { git merge \"$@\" && git submodule update --init --recursive; }; f"
Expand All @@ -44,34 +20,31 @@
# Note that these reference scripts from Khan/git-workflow
# Those scripts should be installed and part of the default path.
phabricator-branch = !git review-branch
rgrep = !git recursive-grep
findreviewers = !git find-reviewers ; old-style had no dash in name

# Abbreviations for KA specific tools
db = !git deploy-branch
rb = !git review-branch
pb = !git review-branch ; short for 'phabricator branch'
rgrep = !git recursive-grep
findreviewers = !git find-reviewers ; old-style had no dash in name

# Other useful commands.
outgoing = "!git fetch >/dev/null 2>&1; git log @{upstream}..HEAD"
incoming = "!git fetch >/dev/null 2>&1; git log HEAD..@{upstream}"
update-submodule = !bash -c 'git pull --no-rebase && pushd $1 && git co master && git pull && popd && git commit ${1%/} -m Substate\\ for\\ ${1%/} -m Test\\ plan: -m None && git push' --

# For after a commit fails with lint, and it says 'commit message saved...'
recommit = "!git commit -F \"`git rev-parse --git-dir`\"/commit.save"
weekly = "!git log --author=$USER --since=`date -d last\\ monday +%Y/%m/%d`"

# Versions of commands with useful options specified.
graph = log --graph --decorate --oneline --pretty=format:"%h%x20%Cgreen%d%x20%Cred%an%x20%Cblue%ad%x20%Creset%s" --all --full-history --date=short
ls-ignored = ls-files --exclude-standard --ignored --others
conflicts = diff --name-only --diff-filter=U

[commit]
template = ~/.git_template/commit_template

[merge]
# Always show a diffstat at the end of a merge
stat = true

[diff]
# Use mnemonic prefixes (index, work tree, commit, object) instead of the standard a and b notation
mnemonicprefix = true

# Detect renames as well as copies
renames = copies

[init]
templatedir = ~/.git_template

Expand Down
38 changes: 38 additions & 0 deletions .gitconfig.khan-xtra
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# These configuration directives used to be part of the global .gitconfig.khan,
# but actually represent global *preferences* rather than anything specific to
# the KA workflow.
#
# They are installed to your filesystem but are not "included" by default.
# If you wish to use them, you can either:
#
# 1. Copy and paste the ones you want into your global ~/.gitconfig, and modify
# as you see fit!
# 2. If you want all of these everywhere (not just in KA directories), you can
# include them in your global gitconfig via :
# `git config --global include.path ~/.gitconfig.khan-xtra`
# 3. If you want these active but only in KA repositories, add a similar
# include.path directive to the ~/.gitconfig.khan file. You can modify the
# file directory or do it from the command line with:
# `git config -f ~/.gitconfig.khan include.path ~/.gitconfig.khan-xtra`
[alias]
# Abbreviations.
st = status
ci = commit
# Show branches (and tags) ordered by last-modified.
br = for-each-ref --sort=-committerdate --format='%(HEAD) %(refname:short)' refs/heads/
tg = for-each-ref --sort=taggerdate --format='%(refname:short)' refs/tags/
df = diff
dfs = diff --staged
lp = log -p
bw = blame -w ; ignore whitespace changes

[merge]
# Always show a diffstat at the end of a merge
stat = true

[diff]
# Use mnemonic prefixes (index, work tree, commit, object) instead of the standard a and b notation
mnemonicprefix = true

# Detect renames as well as copies
renames = copies
File renamed without changes.

0 comments on commit 9f79cfc

Please sign in to comment.