Last active
December 1, 2018 22:42
-
-
Save zaqmor/bddbe576a441d69df617e687efc90680 to your computer and use it in GitHub Desktop.
PowerShell: Profile aliases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. c:\projects\WebUI-PowershellScripts\profile.ps1 | |
# Chocolatey profile | |
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
if (Test-Path($ChocolateyProfile)) { | |
Import-Module "$ChocolateyProfile" | |
} | |
# list branches matching args, '.' for all else exception | |
function fbr { git br --all | ss $args } | |
# find files matching pattern recusively below current dir | |
function ff { get-childitem . -Recurse -File -Include "$args" | select-object -ExpandProperty FullName } | |
# find directories matching pattern recusively below current dir | |
function fd { get-childitem . -Recurse -Directory -Include "$args" | select-object -ExpandProperty FullName } | |
# rename a branch both locally and remotely | |
function rbr | |
{ | |
# should check for br existence... https://stackoverflow.com/questions/5167957/is-there-a-better-way-to-find-out-if-a-local-git-branch-exists | |
$old = $args[0] | |
$new = $args[1] | |
git branch --move $old $new | |
git push origin --set-upstream $new | |
git push origin :$old | |
} | |
# get sha1 file hash | |
function cfh { get-filehash -algorithm sha1 $args | select-object -ExpandProperty Hash } | |
# git nuke all changes | |
function nch { git add *; git rh; } | |
# git commit all changes | |
function cch { git add *; git commit -m "$args"; } | |
# Get all csproj full paths | |
function gcsproj { get-childitem -recurse -inc "*.csproj" | select-object -expandproperty FullName } | |
# Get all csproj dir full paths | |
function gcsprojdir { get-childitem -recurse -inc "*.csproj" | select-object -expandproperty Directory | select-object -ExpandProperty FullName } | |
# Clean all csproj via dotnet clean | |
function ccsproj { gcsp | foreach-object{ dotnet clean $_} } | |
# Delete all csproj output dirs (bin,obj) | |
function dcsprojout { gcsp | get-childitem -recurse -inc bin,obj | ?{$_.PSIsContainer} | select-object -ExpandProperty FullName | remove-item -recurse -force } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment