i was wondering if fusioning two versions of a file on a master branch it's made by cherry-pick, merging or something else. i'll like to fusion a file version of a commit with a past or with a further version. I apologize if this post looks like spam, but you would help me a lot.
centralized and distributed control version command to fusion two versions of the same file into one
Asked
Active
Viewed 28 times
1
-
What do you mean "i'll like to fusion a file version of a commit with a past or with a further version"? Which version do you want to keep, version on master or or version from the cherry-picked commit? – Marina Liu Feb 07 '18 at 05:18
-
i want to keep master, but i mean like for example: i have 5 versions of a file like a json file or a txt file, version 5 it's the most recent, and i want to "merge"or "fusion" version 1 and 4 into one file. – Eduardo Moreno Feb 07 '18 at 05:28
-
Why do you want to fusion the first 4 versions together? Since the 5 versions conducted sequentially, the 5th version actually contains the changes from earlier versions. Besides, if you merge the first 4 versions together, there usually has conflicts during merging. – Marina Liu Feb 07 '18 at 05:37
1 Answers
0
for example: I have 5 versions of a file like a json file or a txt file, version 5 it's the most recent, and i want to "merge"or "fusion" version 1 and 4 into one file
Start a new branch from commit including the version 1 of your file.
git checkout -b newBranch commit1
Then do a git cherry-pick -n <commit 5>
(as in this answer): you will be able to reset any file you don't want to be merged, and keep only the one you need to merge.
Once that is done, if you need to report the end result on your master branch, the simplest way is to simply copy-paste the content on your file in master, and make a new commit (which will include only that file)

VonC
- 1,262,500
- 529
- 4,410
- 5,250