1

I'm managing a project using stash and git. Recently I've seen a new solution for some part of my project. Now I want to apply it as test without affecting my master code and if it would be good enough I add it later to master. So the problem is Should I make a fork from my project or I have to create new Repository? or Any better solution.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
JGC
  • 12,737
  • 9
  • 35
  • 57
  • Do both! Making a new repository is about as painful as making a copy of a file. Clone the repo, create a branch, have a working directory available for each. – William Pursell Feb 13 '16 at 10:04

4 Answers4

5

The solution of your problem is a branch. It is the reason they exists, to allow the development of a feature in an isolated context, without affecting the master.

Read more about branching and merging.

axiac
  • 68,258
  • 9
  • 99
  • 134
0

Since a BitBucket server has branch permission, you could simply create a branch in the same repo.

But if your new solution involve a large refactoring, and adding that branch to the main repo would bring noise (because it is not related to the main development branches), you can make a fork, in which you can push as many branch as you want without polluting the branch namespace of the main repo.

For an experiment unrelated with the development tasks at hand, I would go with a fork.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • My new feature cause lots of files to be removed and some codes be added. But I'm afraid of fork syncing feature and worry about unintended fault in master repos – JGC Feb 13 '16 at 08:44
  • No you control the sync, so no problem there – VonC Feb 13 '16 at 08:45
0

The best way is to branch from master and do the changes in this new branch. This branch can be merged in the master anytime as per needs.

vijayinani
  • 2,548
  • 2
  • 26
  • 48
0

If it is just for a test I suggest a branch. A fork is usually more suitable when you are collaborating among different teams in a company or if open source then to make your changes and submit a pull request.

Just don't merge the test without making sure it works as needed.

xmorera
  • 1,933
  • 3
  • 20
  • 35