Last active
March 19, 2026 10:46
-
-
Save cesclong/81f39a013b4bce525cb18b941862b0b1 to your computer and use it in GitHub Desktop.
新 1. 生成【纯代码分支】(只留代码,配置=develop)
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
| git diff develop --name-only | grep -vE "\.(java|kt)$" | xargs git checkout develop -- | |
| # 查看你改的 Java + Kotlin 文件 | |
| git diff develop --name-only --diff-filter=AM | grep -E "\.(java|kt)$" | |
| # 导出到文件夹 | |
| mkdir my-changes | |
| git diff develop --name-only --diff-filter=AM | grep -E "\.(java|kt)$" | xargs cp -t my-changes/ | |
| git checkout develop -- $(git ls-files -z | grep -zE '\.(json|xml)$' | xargs -0) 2>/dev/null | |
| git checkout 你的分支名 | |
| git checkout -b feat/only-code | |
| git ls-files | grep -E '\.(json|yml|yaml|env|conf|ini|properties)$' | xargs git checkout develop -- | |
| git add . | |
| git commit -m "feat: 仅代码改动,配置恢复到develop" | |
| # 1. 切到你原来的分支 | |
| git checkout 你的分支名 | |
| # 2. 新建配置分支 | |
| git checkout -b feat/only-config | |
| # 3. 先把整个分支恢复成 develop | |
| git reset --hard develop | |
| # 4. 把「你分支上所有配置文件改动」重新应用过来 | |
| git diff 你的分支名 develop --name-only -z -- \ | |
| '*.json' '*.yml' '*.yaml' '*.env' '*.conf' '*.ini' '*.properties' \ | |
| | xargs -0 git checkout 你的分支名 -- | |
| # 5. 提交 | |
| git add -A | |
| git commit -m "chore: 仅配置文件改动(新增+修改+删除)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment