Skip to content

Instantly share code, notes, and snippets.

@kventil
Last active August 27, 2018 07:15
Show Gist options
  • Save kventil/04a66d0c26189a851372c2252b46f9e3 to your computer and use it in GitHub Desktop.
Save kventil/04a66d0c26189a851372c2252b46f9e3 to your computer and use it in GitHub Desktop.
My Powershell Profile (requires posh -> https://www.powershellgallery.com/packages/Posh-SSH/2.0.1)
#Everything GIT
#nothing beats the good old golf
function gti() { echo "Vrooom!"; iex "git $args" }
function ga() { git add -A }
function gs() { git status }
function gas() { git add -A; git status }
function gresetunstaged() { git stash -k -u; git stash drop }
function gcp($msg) { git commit -m "$msg"; git push }
function get() { git pull --ff-only }
#Pretty print graph
function glog() { clear; git --no-pager log --oneline --graph -n 20 --all --format=format:"%<(60,trunc)%s %Cgreen%<(40,ltrunc)%d%Creset" --date-order; echo "`n" }
# fetch, prune pretty print
function gf() { git fetch --all --prune; glog }
#throw away node trash
function clean_node() { git clean -xdf -e "node_modules" -e "bower_components" }
function gco($branch) { git checkout "$branch"}
function rev($branch) {
$currentBranch = git rev-parse --abbrev-ref HEAD
if (-not ($currentBranch -eq "master")) { echo "Not on master"; return }
git merge --no-ff --no-commit "origin/$branch"
}
#get last commit sha
function glc {git log -1 --pretty=%h}
# okay. i give up.
function nevermind() {
git reset --hard HEAD; git clean -d -f
}
#Enable-GitColors
$Host.UI.RawUI.ForegroundColor = "white"; $Host.UI.RawUI.BackgroundColor = "black";
# reload Path (usefull after installing something)
function reload() {
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
}
# open files or directories osx-like
set-alias -Name open -Value explorer
set-alias -Name o -Value explorer
# sticky fingers
set-alias -Name dc -Value cd
# max history
$MaximumHistoryCount = 10000
#posh specific:
Import-Module 'C:\tools\poshgit\dahlbyk-posh-git-9bda399\src\posh-git.psd1'
Import-Module oh-my-posh
Set-Theme paradox
#gradle shortcuts
#run gradlewrapafunction g {./gradlew.bat $args}
# run continous tests
function grt {./gradlew.bat test -t}
#run springboot
function grr {./gradlew.bat clean bootRun}
function gct{./gradlew.bat compileJava -t}
$projectBasePath = "C:\Users\rhibbeler\Projekte\"
#lazy
function uteb {set-location "$projectBasePath\ute\backend"}
function utef {set-location "$projectBasePath\ute\frontend"}
function oecs {set-location "$projectBasePath\mail-templates-backend"}
#more laziness
function d {docker.exe $args}
function c {docker-compose.exe $args}
function up {c up}
#go to $project
function go($project) {set-location "C:\Users\rhibbeler\Projekte\$project"}
#edit powershell profile
function Edit-Profile{code $profile}
#List all Env Variables
function Get-Env{Get-ChildItem Env:$args}
#Set spring profile to <argument>
function Set-Springprofile{[Environment]::SetEnvironmentVariable("spring_profiles_active", $args)}
#unix style which
function which($cmd) { (Get-Command $cmd).Definition }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment