A Journal Through My Activities, Thoughts, and Notes
#git worktree

## 开新工作区

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

git config --global alias.cia 'commit -CHEAD -a --amend'

#git
修复上一次提交中的问题, 延用上一次提交的注释
git ci -a -C HEAD --amend

#git
#git diff -U10

将diff时显示的上下文行数改为10行。
 
 
Back to Top