Reputation: 13
I'm working on a Unity project. We are using Git and have multiple branches. What is the best method to update project to a new Unity version on all branches with minimum hassle?
Note: I don't want to merge all branches and I don't want to update each branch separately.
Upvotes: 1
Views: 1587
Reputation: 38136
There is no such git command which can update all branches at the same time.
Instead, you can achieve it by the workaround to update each branch by script.
Assume the project changed on master
branch, you can update other branches as below:
To update all the files from master branch to other branches:
git checkout branchname
git checkout master -- .
git commit -m 'update all the files same as master branch'
To update certain fles (such as test.cs) from master branch to other branches:
git checkout branchname
git checkout master -- test.cs
git commit -m 'update test.cd from master branch'
Upvotes: 0
Reputation: 3524
Here are the steps to update Unity on all branches:
master
in this post, but dev
is also a common convention.)git rebase
on to master
branch. (You can also git merge
with master
instead of rebasing, if you don't want to push new rebased branches. It also depends on the project's context. For more information on this, see posts such as "Merging vs Rebasing")git reset --hard
to the original commit.Also, here are some items that will make the update easier:
master
, you'll have more obsolete API updates to perform on each branch, and there's a greater risk of merge conflicts and hassles. (But you can verify whether this is an issue before you push the Unity update to remote branches.)As a note, I think it's correct practice to not to update each Unity branch separately. However, I would recommend merging all branches into master
if possible or at least making sure there aren't any long-running branches, as it could complicate the update process.
Upvotes: 0
Reputation: 5397
Update it in the master
branch, then rebase all the other branches onto the tip of the master
branch.
As a side note: usually it's not good practice to put external libraries into the version control of your own projects. They should get pulled in at build time.
Upvotes: 1