File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ --- 
2+ argument-hint : <commit_hash> 
3+ description : Cherry-pick git commit into current branch by "patch" command 
4+ --- 
5+ 
6+ ## Name  
7+ git: cherry-pick-by-patch 
8+ 
9+ ## Synopsis  
10+ ``` 
11+ /git:cherry-pick-by-patch commit_hash 
12+ ``` 
13+ 
14+ ## Description  
15+ 
16+ The ` /git-cherry-pick-by-patch commit_hash `  command cherry-picks commit with hash
17+ ` commit_hash `  into current branch. Rather then doing ` git cherry-pick commit_hash ` ,
18+ the command streams the output of ` git show commit_hash `  to
19+ ` patch -p1 --no-backup-if-mismatch ` , and then commit changes with commit message
20+ from ` commit_hash `  commit.
21+ 
22+ ## Workflow  
23+ 
24+ ### Pre-requisites  
25+ 
26+ The commit with hash ` commit_hash `  must exist. To verify that use:
27+ ``` bash 
28+ git show commit_hash
29+ ``` 
30+ and check if exit code is zero.
31+ 
32+ Fail, if there is no ` commit_hash `  in the current repository checkout.
33+ 
34+ ### Cherry-pick ` commit_hash `  into current branch  
35+ 
36+ 1 .  Execute command
37+     ``` bash 
38+     git show commit_hash |  patch -p1 --no-backup-if-mismatch
39+     ```
40+ and check if  exit  code is zero. Fail if  exit  code is not zero.
41+ 
42+ 2. Find files removed from local  checkout by the patch command  and execute ` git rm` for  them.
43+ 
44+ 3. Find files added or modified by the patch command  and execute ` git add` for  them.
45+ 
46+ 4. Commit changes by ` git commit` command  and use commit title and description from ` commit_hash` 
47+ 
48+ # # Arguments
49+ 
50+ - ** $1 **  (required): Commit hash  (e.g., ` 902409c0` 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments