For example, there is a general class A under the master branch of a project
I created a new branch dev for development (there are 2 branches locally, 1 is master and 1 is dev). The next day The class A code of the master branch has been updated
and if I pull the dev branch, A is still the old version. If I pull the files of the master branch to local dev, the local master and dev will be merged. How to solve this problem?
Of course, don’t pull master to dev. This is essentially a fetch + merge operation, so this is inevitable.
There are actually many solutions. I prefer to use
branch. . Doing so is equivalent to re-"settling" therebase
, that is, firstpull master
, and thenrebase master
under therebase
,也就是先pull master
,然后在 dev 分支下rebase master
。这样做就等于把dev
分支重新“落户”在master
分支的最新节点(即:HEAD)上——当然,这个过程和merge master
devdev
branch on the latest node (ie: HEAD) of themaster
branch - of course, this process is the same asmerge master The same conflict resolution will occur (depending on the differences), but it will not merge the two branches.
In addition, this process should be done frequently (if master is updated frequently); at the same time, if master is the branch you use to deploy, it is best not to update it frequently, otherwise it will be very annoying to roll back if something goes wrong. 🎜
You can checkout a file in other commits