Git dividing branch for new mechanic and updating both of them automatically

38 Views Asked by At

I have a project, and I want to try a new mechanic by modifying the old one. However, I would like git to keep Auto updating old and new mechanics branches until I'm satisfied with choosing one of them after seeing the data.

As an example: Assume I have a script called "character mechanics" which has moving and jumping functions of the character.

void Move(){
//I am moving at the speed of 5
}

void Jump(){
//jumping without checking stamina
}

and a script called Common Mechanics which includes other stuff.

So, this was my main branch, I will create a branch called "newJump". In the newJump jump function of the character mechanics changed to this;

void Move(){
//I am moving at the speed of 5
}

void Jump(){
//jumping with checking stamina
}

After this point whenever I change something in main branch such as changing common mechanics or adding new script or even changing the Move function, I want git to apply the same changes to newJump branch as well. However, I want to keep out jumping mechanics from the changes.

For example, if I do some changes in main branch;

changes on main branch:

void Move(){
//I am moving at the speed of 10
}

void Jump(){
//jumping without checking stamina
}

after merging this with newJump branch, I want it to look like this:

void Move(){
//I am moving at the speed of 10
}

void Jump(){
//jumping with checking stamina
}

Is it possible? Do I need to keep updating both branches manually?

0

There are 0 best solutions below