I want to push a local project into a Bitbucket Repository without synchronizing the local project with the full Bitbucket Repository

Issue

I have several software repository for different customers. Each software repository on Bitbucket has its own local project on my computer right now, which is connected with its specific Bitbucket Repository. All software projects are mostly similar to each other. There are just some folders and files unique. So, each time I develop a new version of this software, I need to implement the changes manually in each local project with my editor, and pull each project to the Bitbucket Repositories. But I want to do it different. I just want to have one project local, where I develop the software, and push it into all Bitbucket Repositories, which are all a bit different to each other. So I need to override some common files and folders on the Bitbucket Repositories for that.

I am thankful for any solutions, or a Link of a service set up, I could use for my intention!

Alex

I tried it with .gitignore, but straight after I set .gitignore either it does not work, and overrides all for each Repositories when i push the project (I made tests for it), or it works, but just after this command:

git rm -rf --cached .

But it removes all files, and after it, it pushes all files, like in .gitignore set up.

The problem is, that I do not want to remove all other files in the repositories. It is necessary for my intention, to let the repositories on Bitbucket be different than my local project, and just push specific folders and files, and ignoring everything else.

So I can use in .gitignore:

*

!... specific files I want to overwrite

But .gitignore is just working, after deleting all files with that command written above, which removes files, and let`s us add all local files after (syncronizing repositories and local project).

So, how is it possible, to push local changes from a project, which is NOT synchronized with a repository on bitbucket (has different files and folders), and merges them automatically, without any errors. Can I use .gitignore with a special set up, without the git rm -rf --cached . commant, but to let it work still, too?

Or is there a solution with a manual bitbucket set up for that?

Solution

You could use branches. Since the code is reused, have it all in a single repository and use per-customer branches.

This question is not specific to Bitbucket, but is about Git in general IMO. I think that Bitbucket does not have and special feature on top of git to facilate this workflow.

Answered By – bahrep

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published