1

What i'm trying to achieve is to have 1 repository on bitbucket, with 2 separate branches, 1 for development and 1 for production.

Lets say I have a repository which has the following files

public_html
   - node_modules
   - package.json
   - scss
   - mynotes.txt
   - style.css

I need to be able to push all of these files (except the node modules) up to bitbucket so other developers can work on the repo.

I also need to be able to have a separate .gitignore which ignores all files that are not needed for production.

So lets say I have the full development on my local machine which .gitignore looks like this

node_modules
mynotes.txt

And a separate production branch which .gitignore looks like this

node_modules
mynotes.txt
sass
package.json

I then start editing the sass files, which generate a new style.css file and push all of my changes up to the repo.

I then want to ssh into my server, and do a git pull on the production version, but the production version only pulls the style.css file thats been changed, not any of the other files.

Basically what i'm trying to achieve is both production and development being fed off 1 repository. But being able to pull down different files based on different .gitignores.

Sorry if this sounds confusing, its quite hard to explain!

2
  • Are you pushing node_modules to your version control? Commented Oct 19, 2018 at 11:45
  • No, i never want the node_modules folder to go up Commented Oct 19, 2018 at 11:45

1 Answer 1

1

At plain sight, it can't be done. You can't just tell git "hey.... Pull from that other branch.... But only this and that file, not the others". If you want to try something like that you might have to use a third branch where you keep changes for those file so that you can easily pull from it to production without having changes in the flies you do 't want to carry into production.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.