diff --git a/README.md b/README.md index 8a2e2bc..a777442 100644 --- a/README.md +++ b/README.md @@ -71,12 +71,14 @@ git config --global alias.alias "config --get-regexp ^alias\." # 必須是 Windows 平台才會執行以下設定 git config --global alias.ignore '!gi() { curl -sL https://www.gitignore.io/api/$@ ;}; gi' git config --global alias.iac '!giac() { git init -b main && git add . && git commit -m 'Initial commit' ;}; giac' +git config --global alias.coc '!gcoc() { git checkout -- . && git clean -df ;}; gcoc' git config --global alias.cz '!npx cz' git config --global alias.changelog "!conventional-changelog -p angular -i CHANGELOG.md -s" # 必須是 Linux/macOS 平台才會執行以下設定 git config --global alias.ignore '!'"gi() { curl -sL https://www.gitignore.io/api/\$@ ;}; gi" git config --global alias.iac '!'"giac() { git init -b main && git add . && git commit -m 'Initial commit' ;}; giac" +git config --global alias.coc '!'"gcoc() { git checkout -- . && git clean -df ;}; gcoc" git config --global alias.cz '!'"npx cz" git config --global alias.changelog '!'"conventional-changelog -p angular -i CHANGELOG.md -s" diff --git a/bin/index.js b/bin/index.js index e4c44cd..a49df41 100644 --- a/bin/index.js +++ b/bin/index.js @@ -80,6 +80,12 @@ const fs = require('fs'); await cmd("git config --global alias.iac '!'\"giac() { git init -b main && git add . && git commit -m 'Initial commit' ;}; giac\""); } + if (os === 'win32') { + await cmd("git config --global alias.coc \"!gcoc() { git checkout -- . && git clean -df ;}; gcoc\""); + } else { + await cmd("git config --global alias.coc '!'\"gcoc() { git checkout -- . && git clean -df ;}; gcoc\""); + } + if (os === 'win32' && fs.existsSync('C:/PROGRA~1/TortoiseGit/bin/TortoiseGitProc.exe')) { await cmd("git config --global alias.tlog \"!start 'C:\\PROGRA~1\\TortoiseGit\\bin\\TortoiseGitProc.exe' /command:log /path:."); } diff --git a/cspell.json b/cspell.json index bb3d867..6fd174e 100644 --- a/cspell.json +++ b/cspell.json @@ -9,6 +9,7 @@ "Cgreen", "Creset", "dcommit", + "gcoc", "giac", "leoli", "longpaths",