From 183e3a11e8c069413f26338fa163ffceed4a0fa4 Mon Sep 17 00:00:00 2001 From: Laurent Le Houerou Date: Thu, 2 Sep 2021 08:58:04 +0400 Subject: [PATCH] gitconfig --- .gitconfig | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.ps1 | 3 +- 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 .gitconfig diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..65d9360 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,83 @@ +[user] + name = Laurent Le Houerou + email = laurent@lehouerou.net + +[url "https://git.lehouerou.net"] + insteadOf = gitea: + +[url "https://github.com/"] + insteadOf = gh: + +[color] + ui = true + +[color "branch"] + current = yellow reverse + local = yello + remote = green + +[color "diff"] + meta = yellow bold + frag = magenta bold + old = red bold + new = green bold + +[color "status"] + added = yellow + changed = green + untracked = red + +[alias] + # Add and remove all changes, note how this alias is calling another alias + addremove = !git r && git add . --all + + # Show all of my configured aliases + aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ \t => \\2/' | sort + + # For when you made that commit a bit too early, amend + amend = !git log -n 1 --pretty=tformat:%s%n%n%b | git commit -F - --amend + + # Show all branches + br = branch -av + + # Show the current branch name (usefull for shell prompts) + brname = !git branch | grep "^*" | awk '{ print $2 }' + + # Delete a branch + brdel = branch -D + + # Which files are receiving the most "love" + churn = !git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print "count,file"} {print $1 "," $2}' + + # View the log and diff for a commit (previous if no SHA1 provided) + details = log -n1 -p --format=fuller + + # Save a repo as a tarball + export = archive -o latest.tar.gz -9 --prefix=latest/ + + # Unstage changes from the index + unstage = reset HEAD -- + + # View a pretty git log with branch tree + g = !git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative + + # Return a list of commit SHA1s + l = "!f() { git log $* | grep '^commit ' | cut -f 2 -d ' '; }; f" + + # Remove deleted files + r = !git ls-files -z --deleted | xargs -0 git rm + + # Return the repository's root directory (usefull for shell prompts) + root = rev-parse --show-toplevel + + # Update all submodules + subup = submodule update --init + + # List all tags + tags = tag -l + + # Start a new local repository and perform initial commit + this = !git init && git add . && git commmit -m \"Initial commit.\" + + # Thin out older metadata within the repository, reduceses filesystem footprint + trim = !git reflog expire --expire=now --all && git gc --prune=now \ No newline at end of file diff --git a/setup.ps1 b/setup.ps1 index de3ca74..29d33d1 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -6,4 +6,5 @@ Install-Module PSReadLine -AllowPrerelease -Force -RequiredVersion 2.2.0-beta1 mkdir -p (Split-Path -Path $PROFILE) Copy-Item powershell_profile.ps1 $PROFILE mkdir -p ~/.config/ohmyposh -Copy-Item posh_config.json ~/.config/ohmyposh/config.json \ No newline at end of file +Copy-Item posh_config.json ~/.config/ohmyposh/config.json +Copy-Item .gitconfig ~/.gitconfig \ No newline at end of file