1

I created this repo as a sample: https://github.com/neves/deploy-workflow

I do my work on "master" and use the "deploy" branch for deploying to server. On master branch, I don't want to track the assets/vendor/*, so I ignore them.

On deploy branch I add them, because they need exist for deploy. All working till here.

The problem is that when I checkout back to master, the ignored content inside assets/vendor/ folder are deleted.

How can I stop that? Is there a better way to keep a separated branch for deploying with some different files in?

Neves
  • 158
  • 2
  • 10

1 Answers1

0

You can setup a "excludefile" directive just for the master branch (in order to ignore assets/vendor/*), while not ignoring that directory in the deploy branch.

See "Using git, how do I ignore a file in one branch but have it committed in another branch?"

cd .git/
$ touch info/exclude_from_master
$ echo "assets/vendor/" > info/exclude_from_master

git config core.excludesfile +info/exclude
git config branch.master.excludesfile +info/exclude_from_master
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I've tried this before. To be sure, I repeat your exact same code and didn't work either. git version 1.8.2.3 – Neves Jun 28 '13 at 11:35
  • excludesfile = +info/exclude_from_master doesn't work on branch or even on core. But if I add assets/vendor/ to info/exclude, it works, but for all branchs. – Neves Jun 28 '13 at 11:46
  • @user2529613 ok, I thought it was worth mentioning. I will test it later. – VonC Jun 28 '13 at 12:00