1

I have a website linked to Git repository at Bitbucket. This site is multi language but I need to upload to repository only spanish and english languages. The problem here is that same structure is present on several paths. See the example below (the same language structure is repeated on multiples paths):

system\
    cms\
    language\
        arabic\
        brazilian\
        chinese_simplified\
        chinese_traditional\
        czech\
        danish\
        dutch\
        english\
        finnish\
        french\
        german\
        greek\
        hebrew\
        hungarian\
        indonesian\
        italian\
        khmer\
        lithuanian\
        persian\
        polish\
        portuguese\
        russian\
        slovenian\
        spanish\
        swedish\
        thai\
        vietnamese\
    modules\
        addons\
            language\
                arabic\
                brazilian\
                chinese_simplified\
                chinese_traditional\
                czech\
                danish\
                dutch\
                english\
                finnish\
                french\
                german\
                greek\
                hebrew\
                hungarian\
                indonesian\
                italian\
                khmer\
                lithuanian\
                persian\
                polish\
                portuguese\
                russian\
                slovenian\
                spanish\
                swedish\
                thai\
                vietnamese\
        blog\
            language\
                ...
        comments\
            language\
                ...
        contact\
            language\
                ...
        files\
            language\
                ...
        keywords\
            language\
                ...
        maintenance\
            language\
                ...
        navigation\
            language\
                ...
        pages\
            language\
                ...
        permissions\
            language\
                ...
        redirects\
            language\
                ...
        search\
            language\
                ...
        settings\
            language\
                ...
        sitemap\
            language\
                ...
        streams_core\
            language\
                ...
        templates\
            language\
                ...
        users\
            language\
                ...
        variables\
            language\
                ...
        widgets\
            language\
                ...
        wysiwyg\
            language\
                ...

Is there any way, or regex if it's supported on .gitignore to allow only spanish and english and ommit the rest of them?

Edit: toydarian solution Following @toydarian suggestion I added this lines to .gitignore file:

language/arabic/*
language/brazilian/*
language/chinese_simplified/*
language/chinese_traditional/*
language/czech/*
language/danish/*
language/dutch/*
language/finnish/*
language/french/*
language/german/*
language/greek/*
language/hebrew/*
language/hungarian/*
language/indonesian/*
language/italian/*
language/khmer/*
language/lithuanian/*
language/persian/*
language/polish/*
language/portuguese/*
language/russian/*
language/slovenian/*
language/swedish/*
language/thai/*
language/vietnamese/*

But as image shows, it's not working, any other advice or way?

enter image description here

ReynierPM
  • 17,594
  • 53
  • 193
  • 363
  • I think you should be able to add `language/` on line 1 to ignore all language directories, then afterward add `!english/` and `!spanish/` on the subsequent 2 lines... try it out first before I officially answer the question. – Neil Traft Aug 12 '14 at 22:59

1 Answers1

1

You can use wildcards as you can use in the shell. look here
Regular expressions are not supported.

So the only thing is to add <language>/* for every language, you want to exclude to your .gitignore
That will exclude every sub-directory of <language>

<language> is a placeholder for a specific language like "german"

Community
  • 1
  • 1
toydarian
  • 4,246
  • 5
  • 23
  • 35
  • So, if I understand I'll need to add several lines as `system/cms/language/german`, `system/cms/language/french`, `system/cms/language/italian` and so on? – ReynierPM Jul 06 '14 at 15:14
  • no, you need exactly one line for every language looking like this: `/*`. e.g. `german/*`, `thai/*` and `polish/*` – toydarian Jul 06 '14 at 15:19
  • Well I did this: `system/cms/language/* !system/cms/language/english !system/cms/language/spanish` but doesn't work I'm still seeing all the languages, is that wrong? I mean I exclude every but spanish and english – ReynierPM Jul 06 '14 at 15:20
  • As I said, you can use any wildcards, you can use in the bash. so excluding with `!path/to/dir` does not work. See my comment five minutes ago. That's the only way, I can see. – toydarian Jul 06 '14 at 15:25
  • Well, `.gitignore` does not work on files, you already added to the repository... – toydarian Jul 06 '14 at 15:41
  • Yes, it was added before but now I want to delete them from the repository and leave out, is that possible? – ReynierPM Jul 06 '14 at 15:42
  • yes, you can delete files from a git repository with the `git rm` command. That will delete them from the file system, though. – toydarian Jul 06 '14 at 15:44