A
A
apecherin2013-12-19 16:12:36
git
apecherin, 2013-12-19 16:12:36

Git: merge branch. How to ignore certain files when merging?

There are two branches -
master and beta.
How to organize their merging, provided that it is necessary to ignore a certain list of files.
For example, there is a RoR application, when merging branches, you must not pay attention to files from the ./config directory, that is, these files must remain unique for each of the branches.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
Codebaker, 2013-12-19
@apecherin

From git-book :
Let's say you want to leave config.xml intact:
In the master branch:
Create a .gitattributes file in the same directory with: config.xml merge=ours. This will tell git what merge-strategy it should use when working with this file. In this case, it will always leave your version of the file untouched, for example leaving it untouched in the devel branch if you merge into it.
Add (-a) .gitattributes and commit to it
For the devel branch, repeat the same steps. Try to merge - the files specified in .gitattributes should remain untouched.
Did it help?

A
Alexey Kiselev, 2013-12-19
@alexeykiselev

Branches are not needed yet, master is enough.
If your active development is related to the introduction of new features required by the customer, do everything in the master branch. I suggest you make a tag on the version that works for the customer on the production server. After that, continue development in master and thus get the development version of the product. Which you will put on the development server.
If you need to fix something in the production version, make a branch from the tag and make changes in it. Merge changes to master if necessary.
And remember Git is not a deployment tool. The way you describe your problem suggests that you are simply pulling one of the branches on the servers. Well if I'm wrong, since you don't need to do this, it's bad from a security point of view.

D
Dmitry Filatov, 2013-12-19
@i_dozi

.gitignore - there is a list of what to ignore

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question