A Journal Through My Activities, Thoughts, and Notes
## Git add everything except whitespace changes
In short, you can use this command:
> git diff -w -b | git apply --cached --ignore-whitespace
You can also add a #git alias like this
> git config --global alias.smartadd '!f() { git diff -w -b | git apply --cached --ignore-whitespace; }; f'
so, you can simply use 'git smartadd'
Reference
In short, you can use this command:
> git diff -w -b | git apply --cached --ignore-whitespace
You can also add a #git alias like this
> git config --global alias.smartadd '!f() { git diff -w -b | git apply --cached --ignore-whitespace; }; f'
so, you can simply use 'git smartadd'
Reference
#git worktree
## 开新工作区
若
这会在
## 删除不再需要的工作区
Git 会自动清理 Git 记录并删除该目录(前提是该目录是干净的,没有未提交修改)。如果有未提交修改,你需要手动处理或加
## 开新工作区
git worktree add ../new-dir main or other branch name
若
../new-dir
不存在,Git 会自动创建。这会在
../new-dir
下创建一个新的工作树,指向当前仓库的 main
分支,两个目录共享 .git
数据。## 删除不再需要的工作区
git worktree remove ../new-dir
Git 会自动清理 Git 记录并删除该目录(前提是该目录是干净的,没有未提交修改)。如果有未提交修改,你需要手动处理或加
--force
:git worktree remove --force ../new-dir