H
H
HoHsi2016-02-07 14:04:56
git
HoHsi, 2016-02-07 14:04:56

How to merge some files from another branch in GIT?

Good afternoon!
How to merge from often files from another branch?
Let's say I have a "feature" branch, and in it:
feature-1.cpp
feature-2.cpp
feature-3.cpp
feature-4.cpp
feature-5.cpp
And I want to merge into the master, only 1 and 2 file

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cat Anton, 2016-02-07
@27cm

If files 1 and 2 are not in your branch, but only in feature:

$ git checkout feature -- feature-1.cpp feature-2.cpp
$ git add --all
$ git commit -m "Merge some files from feature"

If not, and you need an honest merge of files, then create a feature-v2 branch based on feature, delete unnecessary files there and merge the main branch with feature-v2.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question