Ali Sepehri.Kh
Ali Sepehri.Kh

Reputation: 2508

How can I handle two versions of a project?

I have two versions of a project that have some minor differences to each other. Also the base of the project (common part) is changing frequently. To handle this situation I am using git and TortoiseGit. For example br1(1st version) and br2(2nd version) are sub-branches of master.

master
  |----br1
  |----br2

Now When I'm working on branch br1 I want to commit some changes to master branch. Is it possible? Or do you have any other suggestion to handle this situation?

Upvotes: 0

Views: 78

Answers (2)

Andrei Dascalu
Andrei Dascalu

Reputation: 1177

The most straightforward solution is this:

while on master use this command:

git cherry-pick

Where the is the hash of the commit you want to put on the master (from br1 or br2).

However, you need to be careful with this workflow: as time goes by, master, br1 and br2 will begin to diverge more and more, therefore the files holding the differences will become larger and the repo slower.

Upvotes: 1

urmaul
urmaul

Reputation: 7340

Also you can create 3rd branch like "common". It will be harder to switch between branches to make common/branch specific changes but it will be easier to merge it.

Upvotes: 1

Related Questions