diff --git a/git/README.md b/git/README.md new file mode 100644 index 0000000..36fc4d7 --- /dev/null +++ b/git/README.md @@ -0,0 +1,14 @@ +# Git Scripts + +### Definition + +These scripts should be used to demonstrate how combine the power of nushell with git commands. + +### Aliases +If you find some of these scripts useful you can add them as aliases in your git config file. + +For instance you can create a nushell script in your computer and define in your git config file an alias that call that script: +``` +[alias] + bcl = !nu \"D:\\Tools\\gitalias_bcl.nu\" +``` \ No newline at end of file diff --git a/git/git_branchcleanup_.nu b/git/git_branchcleanup_.nu new file mode 100644 index 0000000..b87d7ba --- /dev/null +++ b/git/git_branchcleanup_.nu @@ -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 } \ No newline at end of file