Skip to content

Commit

Permalink
feat(git): Add alias
Browse files Browse the repository at this point in the history
  • Loading branch information
aiotter committed Apr 25, 2024
1 parent 492a518 commit 139e6a1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions git.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
userEmail = "[email protected]";

aliases = {
delete-squashed = ''
!f() { local targetBranch=''${1:-master} && git checkout -q $targetBranch && git branch --merged | grep -v \"\\*\" | xargs -n 1 git branch -d && git for-each-ref refs/heads/ \"--format=%(refname:short)\" | while read branch; do mergeBase=$(git merge-base $targetBranch $branch) && [[ $(git cherry $targetBranch $(git commit-tree $(git rev-parse $branch^{tree}) -p $mergeBase -m _)) == \"-\"* ]] && git branch -D $branch; done; }; f
'';
fpush = "push --force-with-lease";
get = "!ghq get";
graph = "log --graph --pretty=format:'%C(yellow)%h%Creset -%C(auto)%d%Creset %s (%cr) %C(blue)<%an>%Creset' --abbrev-commit --date=relative";
list = "!ghq list";
one = "!git log --oneline --color=always | head";
sync = "!git fetch && git reset --hard origin/$(git branch --show-current)";
unstage = "reset HEAD";
delete-squashed = ''
!f() { local targetBranch=''${1:-master} && git checkout -q $targetBranch && git branch --merged | grep -v \"\\*\" | xargs -n 1 git branch -d && git for-each-ref refs/heads/ \"--format=%(refname:short)\" | while read branch; do mergeBase=$(git merge-base $targetBranch $branch) && [[ $(git cherry $targetBranch $(git commit-tree $(git rev-parse $branch^{tree}) -p $mergeBase -m _)) == \"-\"* ]] && git branch -D $branch; done; }; f
'';
};

delta = {
Expand Down

0 comments on commit 139e6a1

Please sign in to comment.