Support cherrypicking a single or multiple files from a commit
Add the ability to cherry pick a single or multiple files in a commit as supposed to the entire commit.
Comments: 9
-
18 Jun, '21
Ravindra Gullapalli MergedRight now, if we have to restore a specific file from an old commit, we have to go to the file history and then copy the content and replace the content in the working tree.
This works for text files. What about binary files?
So, it would be an useful option to replace a specific file from a past commit. -
03 Aug, '21
Kurt Imga Merged-You typically merge commits or whole branch from one branch to another, but you can't do it in file or folder level.
-I want to merge file/folder rather than just commits.
-In my case I want to merge only Azure Data Factory(ADF) changes from Dev branch to Master branch except any other commits/entire branch. By this way, instead of cherry pick which merges the desired commits one by one painfully, you will be able to merge the all ADF folder editions(delete,add,edit etc.) at once.
- As a note, you can do this by Git Bash which is a CLI application. Have a look the following link if you want to see the related case and solution by using CLI.
https://stackoverflow.com/questions/10784523/how-do-i-merge-changes-to-a-single-file-rather-than-merging-commits -
17 Dec, '21
Peter HeadlandThis is a closely related to another request (that currently has a few more votes) to reset a file to a specific commit.
-
17 Dec, '21
Peter Headland MergedI think this is a functional duplicate of two other requests for cherry-picking a single file. Maybe merge all three?
-
17 Dec, '21
Peter Headland MergedIs this equivalent to four other functionality requests for cherry-picking individual files (not all described that way - I have added comments to all of them).
-
20 Dec, '21
Jonathan Admin"Option to replace a specific file from a past commit" (suggested by Ravindra Gullapalli on 2021-06-18), including upvotes (3) and comments (1), was merged into this suggestion.
-
20 Dec, '21
Jonathan Admin"Merge A Specific File/Folder" (suggested by Kurt Imga on 2021-08-03), including upvotes (3) and comments (1), was merged into this suggestion.
-
27 Dec, '21
John CornelisonThis process should be made easier, as suggested above.
For now a *workaround* is:
"Cherry pick the whole commit with the file, and then choose NO to commiting the changes. Then, you can discard the changes you do not need and only keep the specific file(s) change(s) that you want. " -
02 Nov, '22
DominiqueThis should be easy to implement something like:
git checkout <COMMIT#> <path/to/the/file>
It would also be nice to cherry-pick specific changes in a file as well.
In addition, adding the -p option allows you to interactively apply a patch of the file if you only need a subset of the file contents.