alternative to rebasing pushed commits

梦想的初衷 提交于 2019-12-10 11:29:26

问题


The GitHub documentation recommends against rebasing commits that have been pushed publicly.

We have two branches master and dev. I have made a change to master for a hotfix that I would like to take across to dev, dev itself is fairly far ahead of master.

In this case the hotfix is to 2 files and is only a 1 line change in each.

What is the easiest way to get this to the dev branch without confusing things terribly?


回答1:


If the hotfix is the only thing in master that isn't in dev you could simply merge master into your dev branch.

Otherwise, you'd probably want to just cherry pick that hotfix commit into your dev branch. Assuming that the hotfix is the latest commit in master you could just do:

git checkout dev
git cherry-pick master


来源:https://stackoverflow.com/questions/13338089/alternative-to-rebasing-pushed-commits

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!