feat: initial config
This commit is contained in:
commit
df5ce78519
16 changed files with 412 additions and 0 deletions
modules/applications/git
39
modules/applications/git/aliases.nix
Normal file
39
modules/applications/git/aliases.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Most of these are copied from: https://github.com/Brettm12345/nixos-config/blob/1400c71bce/modules/applications/git/aliases.nix
|
||||
|
||||
let
|
||||
git = text: ''"!git ${text}"'';
|
||||
f = text: ''"!f(){ ${text} };f"'';
|
||||
in {
|
||||
# Unstage all changes
|
||||
unstage = "reset HEAD --";
|
||||
|
||||
# Ammend to the last commit
|
||||
amend = "commit --amend -C HEAD";
|
||||
|
||||
# List branches sorted by last modified
|
||||
b = git
|
||||
"for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'";
|
||||
|
||||
# Test merge for conflicts before merging
|
||||
mergetest = f ''
|
||||
git merge --no-commit --no-ff "$1"; git merge --abort; echo "Merge aborted";'';
|
||||
|
||||
# Get description of current repo
|
||||
description = git
|
||||
''config --get "branch.$(git rev-parse --abbrev-ref HEAD).description"'';
|
||||
|
||||
# Show authors
|
||||
authors = ''
|
||||
"!f() { git log --no-merges --pretty='format:%<(26)%an <%ae>' --author "$*" | sort | uniq# }# f"'';
|
||||
|
||||
a = "add";
|
||||
cm = "commit --message";
|
||||
caa = "commit --ammend";
|
||||
cl = "clone";
|
||||
co = "checkout";
|
||||
col = "checkout @{-1}";
|
||||
cob = "checkout -b";
|
||||
st = "stash";
|
||||
pop = "stash pop";
|
||||
t = "tag";
|
||||
}
|
20
modules/applications/git/default.nix
Normal file
20
modules/applications/git/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ pkgs, ... }: {
|
||||
home-manager.users.adrielus = {
|
||||
home.packages = with pkgs.gitAndTools; [ hub ];
|
||||
programs.git = {
|
||||
enable = true;
|
||||
|
||||
userName = "Matei Adriel";
|
||||
userEmail = "rafaeladriel11@gmail.com";
|
||||
|
||||
aliases = import ./aliases.nix;
|
||||
|
||||
extraConfig = {
|
||||
github.user = "Mateiadrielrafael";
|
||||
hub.protocol = "ssh";
|
||||
|
||||
rebase.autoStash = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue