Reputation: 89
Let's say my repo looks like this:
myApp
public
index.html
...
tests
foo.js
...
I want the tests
folder to get pushed to GitHub but NOT to my server. How do I accomplish this?
Since I want tests/
to get pushed to GitHub I cannot simply add /tests/*
to my .gitignore file.
I've tried adding /tests/
to the .git/info/exclude
file on my server, then deleting the contents of /tests
but this did not work.
Upvotes: 1
Views: 132
Reputation: 36
As Schwern said if you actually still want to use git for releases the best choice is make another branch for releases. The steps can be:
In your machine:
A-->B-->C-->D -development
\ \
`->v1---`->v2 -releases
Create the releases branch
git branch releases
git checkout releases
You can then remove the test folder in releases branch
git rm myApp/test
git commit
and merge it with development branch without the folder:
git merge --no-commit development
then you can push the whole project to GitHub. Then in the server you can do:
git pull origin releases
In order to only get the releases branch so you will have this structure in your server.
->v1----->v2 -releases
Upvotes: 2
Reputation: 164679
.gitignore
and .git/info/exclude
don't ignore changes. They only say what to consider untracked. Once a file is tracked, they have no effect.
It sounds like you're using Git as a release tool and have run into one of the many problems with that. Version control is a poor release tool. I would suggest instead using a release/packaging system instead.
There can be benefits to using a git checkout in production. For one, if anything is hot patched it will be obvious. But you'll need a release process.
When you're ready to release...
git checkout release
git merge --no-commit devel
Upvotes: 0