1
0
Fork 0

Add git role

This commit is contained in:
Daniele Tricoli 2021-11-15 19:58:50 +01:00
parent a93bdccd62
commit 225c160f66
5 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
git_become_admin: true
git_become_admin_user: root
git_become: true
git_become_user: "{{ lookup('env', 'USER') }}"

95
roles/git/files/gitconfig Normal file
View File

@ -0,0 +1,95 @@
[include]
path = .gitconfig.local
[alias]
st = status -s
ci = commit
co = checkout
di = diff
ls = ls-files
out = !git fetch && git log FETCH_HEAD..
in = !git fetch && git log ..FETCH_HEAD
branches = branch -a
tags = tag
stashes = stash list
remotes = remote -v
unstage = reset -q HEAD --
discard = checkout --
uncommit = reset --mixed HEAD~
nevermind = !git reset --hard HEAD && git clean -d -f
last = log -1 HEAD
graph = log --graph -10 --branches --remotes --tags --format=format:'%Cgreen%h %Creset• %<(75,trunc)%s (%cN, %ar) %Cred%d' --date-order
glog = log --graph --decorate --abbrev-commit
contributors = shortlog -sn
unmerged = diff --name-only --diff-filter=U
mine = !git log --author="$(git config user.email)"
today = diff @{yesterday}.. --stat
serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git
[core]
editor = nvim
excludesfile = ~/.gitignore
[pager]
diff = delta
log = delta
reflog = delta
show = delta
[interactive]
diffFilter = delta --color-only --features=interactive
[delta]
features = decorations
[delta "interactive"]
keep-plus-minus-markers = false
[delta "decorations"]
commit-decoration-style = blue ol
commit-style = raw
file-style = omit
hunk-header-decoration-style = blue box
hunk-header-file-style = red
hunk-header-line-number-style = "#067a00"
hunk-header-style = file line-number syntax
[color]
ui = auto
branch = auto
diff = auto
status = auto
decorate = short
[commit]
verbose = true
[diff]
algorithm = patience
[grep]
lineNumber = true
[color "grep"]
lineNumber = yellow
[log]
date = iso
[merge]
tool = vimdiff
[push]
default = simple
[pull]
rebase = false
[init]
defaultBranch = main
[cola]
spellcheck = false

View File

@ -0,0 +1,7 @@
# Vim
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
*.un~
Session.vim
.netrwhist
*~

25
roles/git/tasks/main.yml Normal file
View File

@ -0,0 +1,25 @@
---
- name: install git
ansible.builtin.apt:
name: git
update_cache: true
cache_valid_time: 3600
tags: apt
become: "{{ git_become_admin }}"
become_user: "{{ git_become_admin_user }}"
- block:
- name: copy user .gitconfig
ansible.builtin.copy:
src: gitconfig
dest: ~/.gitconfig
- name: copy user .gitignore
ansible.builtin.copy:
src: gitignore
dest: ~/.gitignore
become: "{{ git_become }}"
become_user: "{{ git_become_user }}"

View File

@ -7,5 +7,6 @@
- ../roles/alacritty
- ../roles/emacs
- ../roles/fontconfig
- ../roles/git
- ../roles/neovim
- ../roles/starship