From 18ff8bc9657faa02d7da81e01c9513dc45b770e0 Mon Sep 17 00:00:00 2001 From: Ibrahim Abdulhameed Date: Sat, 30 Aug 2025 18:27:29 +0100 Subject: [PATCH] feat: add git worktrees section --- source/_posts/git.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/source/_posts/git.md b/source/_posts/git.md index e2a98cb..96eaf5a 100644 --- a/source/_posts/git.md +++ b/source/_posts/git.md @@ -440,6 +440,38 @@ See also: [More Aliases](https://gist.github.com/johnpolacek/69604a1f6861129ef08 ## Advanced Git +### Worktrees + +Create a new working tree at the specified path. If a branch is specified, it checks out that branch. If no branch is given, a new one is created based on HEAD and named after the new directory. + +```shell script +$ git worktree add [] +``` + +List all of the active working trees associated with the repository. + +```shell script +$ git worktree list +``` + +Remove the specified working tree. + +```shell script +$ git worktree remove +``` + +Clean up stale or manually deleted working trees. + +```shell script +$ git worktree prune +``` + +Relocate the working tree to a new path. + +```shell script +$ git worktree move +``` + ### Submodules Create a new submodule within your repository: