P
P
Peter2015-07-15 10:44:32
git
Peter, 2015-07-15 10:44:32

How to move certain files from one branch to another branch?

There are two parallel development branches that work on shared files. But in one and the other branch, you need to make changes in these files. Accordingly, it is necessary to pull out only certain files from a certain commit of one branch and upload them to another branch.
How to do this with git?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Ukolov, 2015-07-15
@volkov_p_v

No way, the atomic unit is the commit, they can be transferred, and the parts of the commit - if you please, by hand.

S
Stanislav Makarov, 2015-07-15
@Nipheris

> There are two parallel development branches that work with shared files. But in one and the other branch, you need to make changes in these files.
> Accordingly, it is necessary to pull out only certain files from a certain commit of one branch and upload them to another branch.
I do not understand where the transition from the first to the second. Branches are there to make different changes in the same files. If the changes are the same, merge those commits made in branch A into branch B, or if merging is not possible, then cherry-pick specific commits. Why take anything out?

H
HuckF1nn, 2021-02-01
@HuckF1nn

Copy from here:
How to move files from one branch to another?
Switch to the branch where you want to move the file, for example
git checkout master Pick up
the desired file from another branch
git checkout $branch_name -- $
paths_to_file
the branch in which you originally placed the files, they will remain, you need to delete them yourself if they are not needed there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question