Git: Bettter way than cherry-pick to merge two branches?

Newbie on git, i have two branches in my git project, master and feature, both branches share 80% of the same code, while the other 20% are different, Now i'm working on master, i make a commit on master, and this commit also should be applied to feature branch, if i use merge, there will be conflict as the other 20% code are different, i have to use cherry-pick, and the commit history of the two branches are parallel. This is annoying as i have to cherry-pick every commit from master to feature branch.

Is there one better way to achieve this?


You have a massive problem here, because your branches already differ way too much.

To prevent this, you need to keep them in sync as much as possible.

For future scenarios like this, there are two possible approaches, both of which need to be applied from the beginning:

  1. Merge frequently from master to feature
  2. Frequently rebase feature onto master

I'm pretty sure you can check out specific files with:

git checkout <branch> <commit-ref> <filepath>

If the updates you want to push between branches are contained to specific files then that should let you sync up manually at least.

Need Your Help

Fetching rows of data from a table that isn't in another table


It's been long that I've been encountering this problem and I'll be glad if you guys can help me out on what to do.

Creating a custom 2D array Tile Map with text file using line.Split gives null exception error

java split text-files game-engine multidimensional-array

I have written the following code to read a tile map from a text file, however I am getting a null point exception error for a reason I can't figure out.