Created
November 26, 2019 17:58
-
-
Save BhaaLseN/8d943a63cc5cedc7f19458d20a6ad7fa to your computer and use it in GitHub Desktop.
Git Welcome (setup scripts)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
# Enable file system cache on Windows (no effect on OS X/Linux) | |
# c.f. https://groups.google.com/forum/#!topic/git-for-windows/9WrSosaa4A8 | |
fscache = true | |
[help] | |
autocorrect = 1 | |
[color] | |
diff = auto | |
status = auto | |
branch = auto | |
ui = true | |
[gui] | |
encoding = utf-8 | |
[submodule] | |
fetchJobs = 0 | |
# Configure pull to fetch-and-rebase rather than fetch-and-merge. | |
# Also, prevent these rebases from inlining an existing local merge. | |
# See this article for a thorough explanation: | |
# https://medium.com/@porteneuve/getting-solid-at-git-rebase-vs-merge-4fa1a48c53aa#.ntv2atccl | |
[pull] | |
rebase = preserve | |
[fetch] | |
prune = true | |
[rebase] | |
autoSquash = true | |
autoStash = true | |
[push] | |
default = simple | |
[merge] | |
ff = false | |
[mergetool] | |
prompt = false | |
[branch] | |
autosetuprebase = always | |
autosetupmerge = false | |
[alias] | |
st=status | |
br=branch | |
lol = "log --pretty=oneline --abbrev-commit --graph --decorate" | |
prlog = "log --pretty=oneline --abbrev-commit --graph --decorate --first-parent" | |
trash = reset --hard HEAD | |
pick = cherry-pick -xe | |
label = describe --tags --always --abbrev=8 | |
amend = commit --amend --no-edit | |
linestat = diff --shortstat | |
delmerged = !git branch --merged | egrep -v \"(^\\*|master|release|stable)\" | xargs git branch -d | |
review = !"f() { git checkout --force --detach `git merge-base $1 origin/master`; git merge --ff --squash $1; }; f" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global include.path "$PWD/config.include" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ ! -d ~/.ssh ]; then | |
mkdir ~/.ssh | |
chmod go= ~/.ssh | |
fi | |
if [ ! -f ~/.ssh/id_rsa ]; then | |
ssh-keygen -f ~/.ssh/id_rsa -N "" | |
chmod go= ~/.ssh/id_rsa | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
username=$(logname) | |
email="${username}@domain.tld" | |
# replace dots (and start) with space, then upper-case the letter afterwards | |
realname_lead_space=$(echo $username | sed -r 's/(^|\.)([a-z])/ \U\2/g') | |
# trim the leading space again | |
realname=${realname_lead_space#"${realname_lead_space%%[![:space:]]*}"} | |
echo "You are ${realname} <${email}>." | |
read -r -p "Did we detect this correctly? (Y/N)" response | |
case "$response" in | |
[yY][eE][sS]|[yY]) | |
git config --global user.name "$realname" | |
git config --global user.email "$email" | |
;; | |
*) | |
echo "Please use the following to set your name:" | |
echo "git config --global user.name \"Your Name Here\"" | |
echo "git config --global user.email \"your.name@domain.tld\"" | |
;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sh configure-includes.sh | |
sh create-private-key.sh | |
sh set-user-email.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment