3

I want not to merge a specific folder to another branch.

ex) sample_folder/* merge=ours

On single file, index.php merge=ours works fine. But no idea how to apply this to files inside of the folder.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Sang Lee
  • 41
  • 3
  • I tried the same way as a single file but it's not working for me. Just wondering if something I'm missing! – Athar Mar 26 '17 at 21:51

1 Answers1

2

This should be enough:

sample_folder/ merge=ours 

The gitattributes man page explicitly mention

Some of these settings can also be specified for a path, so that Git applies those settings only for a subdirectory or subset of files

Since the Merge Strategies only mention files, you might have to tweak the file selector

sample_folder/*/* merge=ours 
# or
sample_folder/**/** merge=ours 
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I tested with gitignore and gitattributes, and gitignore is working fine with tree structure. However gitattributes is not working at all with folder structure. I tried sample_folder/ sample_folder/** sample_folder/* sample_folder/test.php sample_folder /sample_folder /sample_folder/ All of them were not working.... Did i miss something? – Sang Lee Sep 14 '15 at 22:55
  • @SangLee what version of git are you using? – VonC Sep 15 '15 at 05:57
  • Version is git version 2.3.2 (Apple Git-55) – Sang Lee Sep 15 '15 at 21:12
  • @SangLee I'll have to check again (I am using 2.5.2) – VonC Sep 15 '15 at 21:13