mplorentz on Nostr: TIL about git worktree. Instead of doing git stash && git checkout, (make changes, ...
TIL about git worktree. Instead of doing git stash && git checkout, (make changes, review PR, etc.), then git checkout - && git stash pop you can run git worktree ../myproject mybranch and git will create a new directory with mybranch checked out. Kind of like if you had cloned the project again. When you are done you can git worktree remove ../myproject.
Published at
2024-07-18 14:06:03Event JSON
{
"id": "b4253998d51462575cb928d5bf5de9ec71c3c1f9e0d2a5fc9a572be87e338e0e",
"pubkey": "d0a1ffb8761b974cec4a3be8cbcb2e96a7090dcf465ffeac839aa4ca20c9a59e",
"created_at": 1721311563,
"kind": 1,
"tags": [],
"content": "TIL about git worktree. Instead of doing git stash \u0026\u0026 git checkout, (make changes, review PR, etc.), then git checkout - \u0026\u0026 git stash pop you can run git worktree ../myproject mybranch and git will create a new directory with mybranch checked out. Kind of like if you had cloned the project again. When you are done you can git worktree remove ../myproject.",
"sig": "f212aa74fb23e6ddd3e829a9dc24a0ceb3cad3f3999d0f214120c44df27dcd67ad5edfe9d3f078c7d2701187b2f23b35b00c1738749a36c4b0c8e4bc395ea350"
}