File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Function to print help and manage arguments
4+ eval $(
5+ zz_args " Pick files from a specific commit" $0 " $@ " << -help
6+ c commit commit commit sha to pick from (if not provided, will prompt)
7+ - path path path to restore (default: current directory)
8+ help
9+ )
10+
11+ # ### Go to repository root
12+ cd " $( git rev-parse --show-toplevel) "
13+
14+ # If no commit is provided, use git getcommit to select one
15+ if [ -z " $commit " ]; then
16+ commit=$( git getcommit)
17+ if [ $? -ne 0 ] || [ -z " $commit " ]; then
18+ zz_log e " No commit selected or invalid commit"
19+ exit 1
20+ fi
21+ fi
22+
23+ # If no path is provided, use current prefix (relative to repo root)
24+ if [ -z " $path " ]; then
25+ path=$( git rev-parse --show-prefix)
26+ # If path is empty (we're at repo root), use current directory
27+ if [ -z " $path " ]; then
28+ path=" ."
29+ fi
30+ fi
31+
32+ zz_log i " Picking files from commit: $commit "
33+ zz_log i " Target path: $path "
34+
35+ # Execute the git restore command
36+ git restore --source=" $commit " --staged --worktree " $path "
37+
38+ if [ $? -eq 0 ]; then
39+ zz_log s " Successfully picked files from commit $commit to $path "
40+ else
41+ zz_log e " Failed to pick files from commit $commit "
42+ exit 1
43+ fi
Original file line number Diff line number Diff line change 22 "id" : " gitutils" ,
33 "name" : " Git Aliases" ,
44 "description" : " A feature to add useful Git aliases to your shell." ,
5- "version" : " 5.24.1 " ,
5+ "version" : " 5.25.0 " ,
66 "dependsOn" : {
77 "ghcr.io/devcontainers/features/node:1" : " lts" ,
88 "ghcr.io/tomgrv/devcontainer-features/common-utils:3" : {
You can’t perform that action at this time.
0 commit comments