Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions aliases/git-wt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ wto() {
# wtn (auto-generated name)
# wtn -b main hotfix
wtn() {
local output
local output line path
output=$(git wt new "$@") || return 1
echo "$output"
local path
path=$(echo "$output" | grep 'Path:' | awk '{print $2}')
[[ -n "$path" ]] && cd "$path" || return 1
while IFS= read -r line; do
if [[ "$line" == *"Path:"* ]]; then
read -r path <<< "${line##*Path:}"
break
fi
done <<< "$output"
[[ -n "${path:-}" ]] && cd "$path" || return 1
}

# List worktrees (current repo)
Expand Down