V
V
Vasya2018-04-27 08:46:23
linux
Vasya, 2018-04-27 08:46:23

How to pull files committed in a separate commit?

There is a folder structure.
In one of the commits I change something.
Next, I want to unload only the changed-added files of this commit, while retaining the parent folders.
It is necessary to transfer the changes to a third party.
Project example:
classes
- general
- - class1.php
- - class2.php
- helpers
- - helper1.php
- - helper2.php
lib
- pdf
- - folder1
- - - file.php
- - - file2.php
- - folder2
- - - script1.php
- - - script2.php
- - file.txt
- - file.php
- xls
Changed files
classes/helpers/helper1.php in separate commit
lib/pdf/folder1/file.php
lib/xls/addedfile.php
The output should be an empty folder structure with modified and added files.
targetfolder
- classes
- - helpers
- - - helper1.php
- lib
- - pdf
- - - folder1
- - - - file.php
- - xls
- - - addedfile.php
Are there solutions out of the box, by git commands.
Or, you did it using the command line.
It's not a problem to grep file paths.
But for implementation, an additional script is needed that will parse the paths, recreate the structure, and copy the files to the appropriate folders.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Victor, 2018-04-27
@haramba

Once upon a time I saved, but did not check:
git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT commit_hash | xargs tar -rf mytarfile.tar

W
Wexter, 2018-04-27
@Wexter

https://git-scm.com/docs/git-cherry-pick

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question