1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00

Merge branch 'main' into changes_for_0320

This commit is contained in:
Darren Schroeder 2021-05-26 12:34:59 -05:00 committed by GitHub
commit b66510fcca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 4 deletions

6
git/git_branch_age.nu Executable file
View file

@ -0,0 +1,6 @@
# Creates a table listing the branches of a git repository and the day of the last commit
git branch | lines | str substring 2, | wrap name | insert "last commit" {
get name | each {
git show $it --no-patch --format=%as
}
} | sort-by "last commit"

View file

@ -0,0 +1,4 @@
# Script that remove outdated local branches from a git repo
# More information on this article https://www.techwatching.dev/posts/cleaning-git-branches
git branch -vl '*/*' | lines | split column " " BranchName Hash Status --collapse-empty | where Status == '[gone]' | each { git branch -D $it.BranchName }

3
git/git_gone.nu Executable file
View file

@ -0,0 +1,3 @@
# gently try to delete merged branches, excluding the checked out one
# This is an alternative to git_branchcleanup.nu
git branch --merged | lines | where $it !~ '*' | str trim | where $it != 'master' && $it != 'main' | each { git branch -d $it }

View file

@ -15,10 +15,11 @@ let nu_table = (echo $nu_files |
wrap File |
insert Category { |it|
let cat = (echo $it.File | path dirname)
if $cat == "" {
echo "not assigned yet"
"not assigned yet"
} {
echo $cat
$cat
}
} | where Category !~ ".git" | select Category File | sort-by Category)
@ -29,5 +30,4 @@ let nu_table = (echo $nu_table | update File { |it|
let file_link = (build-string "[" $file_name "]" "(./" $file_path ")")
echo $file_link
})
echo $nu_table | to md --pretty
$nu_table | to md --pretty