-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy path.gitconfig
134 lines (114 loc) · 7.29 KB
/
.gitconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# This file is part of eRCaGuy_dotfiles: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles
# INSTRUCTIONS:
# Update name and email below, edit other fields as desired, then copy
# (preferred in this case) or symlink it to ~/.gitconfig
# Option 1) if it doesn't exist yet, copy whole thing over: `cp -i .gitconfig ~`
# Option 2) append contents to existing .gitconfig file: `cat .gitconfig >> ~/.gitconfig`
# Option 3) symlink it over:
# cd path/to/here
# ln -si "$PWD/.gitconfig" ~
[user]
name = # FIRSTNAME LASTNAME
email = # [email protected]
[diff]
# Choose your `git difftool` editor. If you comment out the below line, then run `git difftool`,
# you'll see git print out this message, showing a list of commonly-available difftools:
# This message is displayed because 'diff.tool' is not configured.
# See 'git difftool --tool-help' or 'git help config' for more details.
# 'git difftool' will now attempt to use one of the following tools:
# meld opendiff kdiff3 tkdiff xxdiff kompare gvimdiff diffuse diffmerge ecmerge p4merge araxis bc codecompare emerge vimdiff
tool = meld
[core]
# Make the Sublime Text editor your git commit editor
# See my answer here: https://stackoverflow.com/a/48212377/4561887
# editor = subl --project ~/.git_editor.sublime-project --wait
# Make MS VSCode your git commit editor
# See here: https://stackoverflow.com/a/36644561/4561887
editor = code --wait
# OR: to always open a new window too
# editor = code --wait --new-window
# Or for the `micro` editor (https://github.com/zyedidia/micro)
# - See: https://askubuntu.com/a/1388854/327339
# editor = micro
# See also:
# 1. eRCaGuy_dotfiles/.gitattributes
# 1. eRCaGuy_dotfiles/.gitattributes_minimal_example
#
# Control line endings (carriage return (\r) + line feed (\n) [CRLF]
# [Windows] vs. line feed (\n) [LF] only [Linux & MacOS]).
# - See: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration <====
#
# Option 1: for Windows: set it to `autocrlf = true`. "This converts LF
# endings into CRLF when you check out code."
# autocrlf = true # FOR WINDOWS
#
# Option 2: for Linux or MacOS, OR for Windows too where you want to enforce and standardize on
# Unix-style line endings on Windows too: set it to `autocrlf = input`. This will "tell Git to
# convert CRLF to LF on commit but not the other way around". Ie: this will cause git to NOT
# convert back to CRLF, or to anything for that matter, on checkout; ie: it will just stay as
# LF on checkout, if it is already LF.
# [my recommended settings for Linux, Mac, *and* Windows!] <========
# Set these with:
#
# # set global git settings to standardize line endings to LF instead
# # of CRLF
# git config --global core.autocrlf input
# git config --global core.eol lf
#
autocrlf = input # FOR LINUX OR MACOS, OR FOR WINDOWS too, where you want to use LF anyway
eol = lf
#
# GS: MY MAIN CRLF SUMMARY NOTES:
# 1. `autocrlf = false` is the default. See: https://stackoverflow.com/a/48230871/4561887. This
# means that *no* line ending changes are made: neither on commit nor checkout (good for Linux
# when NOT sharing a repo between Windows and Linux).
# 1. `autocrlf = true` converts to LF on commit, and to CRLF on check out (can be acceptable for
# Windows).
# 1. `autocrlf = input` [my favorite for ALL 3 OSs!] converts to LF on commit, but does nothing
# on checkout (good when sharing a repo between Windows and Linux, or whenever some Windows
# files may have been manually copied to the Linux computer, or when you want to force Windows
# to use LF even when some editors or processes on Windows periodically convert files back to
# CRLF, contrary to your desires, and you want git to fix it back to LF each time).
#
# - To **manually** remove CRLF on Windows files which were copied to Linux, see my detailed
# answer here: [How to recursively run `dos2unix` (or any other command) on your desired
# directory or path using multiple processes]
# (https://unix.stackexchange.com/a/751912/114401)
# - (this also teaches how to use `xargs`)
[alias]
# Source for this `git lg` "better git log" alias: https://coderwall.com/p/euwpig/a-better-git-log
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# See:
# 1. [original source] https://stackoverflow.com/a/4299159/4561887
# 1. [my answer] https://stackoverflow.com/a/71150235/4561887
add-commit = !git add -A && git commit
# See my guide:
# https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/README_git_submodules.md#aliases
sub = submodule update --init --recursive
# For 'git blametool'. See: "eRCaGuy_dotfiles/useful_scripts/git-blametool.sh".
# Example:
# - Create an entry below with: `git config --global blametool.editor subl`
# - Read it with: `git config blametool.editor`
[blametool]
editor = subl # Use ANY editor. Ex: subl vim emacs nano gedit leafpad, etc.
auto-delete-tempfile-when-done = true
# TODO: CLEAN UP ALL OF THESE SCRATCH NOTES BELOW; DO THEM, DELETE THEM, MOVE THEM TO BETTER PLACESS TO KEEP THEM AS
# PERMANENT NOTES, ETC.
# http://barkas.com/2018/git-alias-bash-functions-with-arguments/
# and http://barkas.com/2018/git-alias-bash-functions-with-arguments/#git-alias-in-your-path
# example1 = "!f() { echo "Listing branches"; git branch -vva; }; f"
# example2 = "!f() { echo "value passed as parameter is ${1}"; }; f"
############ name it git-whatever and put in your path (ex: ~/bin/git-whatever) and now you can automatically use it as `git whatever`!
# gs_sync_git_repo_from_pc1_to_pc2 ---> rename to "git-sync_repo_from_pc1_to_pc2"!
# git-filechange-search - update instructions! Do one that is gs_... and one that is just git-...
# add this as an alias function here too! BRANCH_BAK=my_branch_bak && git difftool $BRANCH_BAK $(git diff --name-only $(git merge-base $BRANCH_BAK master) $BRANCH_BAK) <======= QUICKLY CHECK NEWLY-REBASED BRANCH AGAINST ITS BACKUP BRANCH! ======= [be sure to change `master` near the end to whatever upstream you have if necessary too!] <=======
# - it's too simple to be worth making it into its own program, yet too complex to just be a regular alias, so make it a git alias function
# and turn my git hash bak script into a stand-alone git function
# and add git-wtf to my dotfiles project, but rename it to git-branch_status, and make a symlink to it called git-wtf; be sure to cite where you're getting it from!
# Consider adding everything in this location, as many of these tools look pretty useful: https://github.com/DanielVartanov/willgit/tree/master/bin
# HOW TO Customize your `git diff` colors.
# See: https://stackoverflow.com/questions/26941144/how-do-you-customize-the-color-of-the-diff-header-in-git-diff/61993060#61993060
# [color "diff"]
# meta = blue # header: blue text
# old = black red strike # deleted lines: black text with red background, strikethrough line through the text
# new = black green italic # added lines: black text with green background, italic text