Last active
May 19, 2024 15:13
-
-
Save keqing77/5b2bbd66e31c3f841538884dd9f5e501 to your computer and use it in GitHub Desktop.
Powershell profile
This file contains 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
function sw() { | |
git switch $args | |
} | |
function unresolve() { | |
git checkout --conflict=merge -- | |
} | |
# temporarily ignoring files | |
function ignore() { | |
git update-index --assume-unchanged | |
} | |
function unignore() { | |
git update-index --no-assume-unchanged | |
} | |
function ignored() { | |
git ls-files -v | env --unset=GREP_OPTIONS grep --perl '^[a-z] ' | |
} | |
function gitignored() { | |
git ls-files --others --directory --ignored --exclude-standard | |
} | |
# git commit | |
function commit() { | |
git commit --verbose | |
} | |
function amend() { | |
git commit --verbose --amend --reuse-message=HEAD | |
} | |
function ci() { | |
git commit --verbose | |
} | |
function cim() { | |
git commit --verbose --message $args[0] | |
} | |
function cima() { | |
git commit --verbose --all --message | |
} | |
function ca() { | |
git commit --verbose --all | |
} | |
function co() { | |
git checkout | |
} | |
# git branch and remote | |
function b() { | |
git branch | |
} | |
function bc() { | |
git checkout -b | |
} | |
function brs() { | |
git branch -a --verbose | |
} | |
function rv() { | |
git remote -v | |
} | |
function pru() { | |
git fetch upstream | |
git rebase upstream/master | |
} | |
function pro() { | |
git fetch origin | |
git rebase origin/master | |
} | |
function mpull() { | |
git branch=${1:-develop} | |
git fetch origin | |
git rebase --preserve-merges origin/$branch $branch | |
} | |
function pub() { | |
git publish | |
} | |
# git add | |
function a() { | |
git add | |
} | |
function au() { | |
git add --update | |
} | |
function aa() { | |
git add --all | |
} | |
function ai() { | |
git add --interactive | |
} | |
function ap() { | |
git add --patch | |
} | |
function aaa() { | |
git add --all | |
git commit --verbose --amend --reuse-message=HEAD | |
} | |
function aua() { | |
git add --update | |
git commit --verbose --amend --reuse-message=HEAD | |
} | |
# git checkout | |
function c() { | |
git checkout $args[0] | |
} | |
function cp() { | |
git checkout --patch | |
} | |
function rp() { | |
git reset --patch | |
} | |
# git fetch | |
function f() { | |
git fetch | |
} | |
# git rebase | |
function r() { | |
git rebase --interactive | |
} | |
function rc() { | |
git rebase --continue | |
} | |
function ra() { | |
git rebase --abort | |
} | |
# git diff | |
function d() { | |
git diff | |
} | |
function p() { | |
git diff --cached | |
} | |
function dc() { | |
git diff --cached | |
} | |
function wd() { | |
git diff --word-diff | |
} | |
function wdc() { | |
git diff --cached --word-diff | |
} | |
function dt() { | |
git difftool | |
} | |
function dtc() { | |
git difftool --cached | |
} | |
function dtp() { | |
git difftool --tool=p4 | |
} | |
function dtcp() { | |
git difftool --cached --tool=p4 | |
} | |
function mt() { | |
git mergetool | |
} | |
function mtp() { | |
git mergetool --tool=p4 | |
} | |
# git status | |
function s() { | |
git status | |
} | |
# git push | |
function pu() { | |
git push upstream | |
} | |
function puf() { | |
git push upstream --force | |
} | |
function po() { | |
git push origin $args[0] | |
} | |
function pof() { | |
git push origin --force | |
} | |
# git log | |
function l1() { | |
git log --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %b %Cgreen(%cd) %C(bold blue)<%an>%Creset" --abbrev-commit | |
} | |
function l2() { | |
git log --pretty=oneline --abbrev-commit --max-count=15 --decorate | |
} | |
function ll() { | |
git log --graph --date-order -C -M --pretty=format:"<%h> %ad [%an] %Cgreen%d%Creset %s" --date=short | |
} | |
function lx() { | |
git log --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %Cgreen(%cd) %C(bold blue) %an [%ae]:%Creset %n %s %n %b %n" --abbrev-commit | |
} | |
function gl() { | |
git glog | |
} | |
function wdw() { | |
git log --pretty="format:%an - %s" | |
} | |
function l() { | |
git log --graph --date-order -C -M --pretty=format:"<%h> %ad [%an] %Cgreen%d%Creset %s" --all --date=short --max-count=15 | |
} | |
function gf() { | |
git log -m -S | |
} | |
function glb() { | |
git log | |
} | |
function glbnm() { | |
git log --no-merges | |
} | |
# misc | |
function pick() { | |
git cherry-pick | |
} | |
function mcp() { | |
git multi-cherry-pick | |
} | |
function unstage() { | |
git reset HEAD | |
} | |
function reword() { | |
git commit --amend | |
} | |
function cleanf() { | |
git clean -xdf | |
} | |
function review-files() { | |
git log --name-only --max-count=1 | |
} |
This file contains 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
# 查看配置文件 | |
$profile | |
# 使用 VS Code 编辑配置文件 | |
code $profile | |
# 测试函数 | |
function test { | |
echo "i am a test output" | |
} | |
# Set-ExecutionPolicy Unrestricted 设置权限 | |
# pnpm | |
function i { | |
pnpm i $args | |
} | |
function u { | |
pnpm update $args | |
} | |
# run | |
function d { | |
if (Test-Path ./package.json) { | |
pnpm dev | |
} elseif (Test-Path ./pom.xml) { | |
# 用 nodemon 监听所有 controller 下的 java 文件,改变时自动重启 | |
nodemon -w /controller/**/* -e "java" -x "mvn spring-boot:run" | |
} else { | |
echo "No package.json or pom.xml found" | |
} | |
} | |
# start | |
function bing { | |
Start "http://www.bing.com/search?q=$($args -join ' ')" | |
} | |
function github { | |
Start "https://github.com/search?q=$($args -join ' ')&type=repositories" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment