How can I just merge the source code files, say *.h
and *.cpp
, in Git?
The repository on Github contains the whole solution file including project and compiler data and build executables.
How can I just merge the source code files, say *.h
and *.cpp
, in Git?
The repository on Github contains the whole solution file including project and compiler data and build executables.
You can declare a merge driver in a .gitattributes
file in order to:
.cpp
or .h
(as in this answer)Another option is described in this answer:
git merge --no-commit branchSource
# for each non .cpp or .h files:
git checkout branchDestination -- file
But that is a bit cumbersome.
That being said, a merge should involve the all content of a commit, which is why not* versioning elements you don't want to merge is a good idea.
When those elements can be generated at will (build executable), this is twice a good idea (as commented by KingCrunch).