Git - Moving Pushed Commits to a Different Branch

自作多情 提交于 2019-12-02 16:11:39

Getting the branch is easy:

git branch their-branch master
git reset --hard master $SHA1_OF_C
git push --force $SHARED_REPO_REMOTE

This will rewrite history; it creates a new branch that is equivalent to the current master branch named their-branch, then resets your local master to point to a random SHA1 (...or branch, or tag, or whatever), and finally forcibly updates the remote repository branch to match your local branch.

That delivers exactly the situation you want.

Caveats: this will rewrite history, and can screw up anyone who has built off the old master. Watch out for merge problems following.

No rebasing desired or required.

(As an aside, I suggest you either give them a staging repository, or get them to use git send-email, or use GitHub pull requests, or otherwise prevent them pushing to master until they get it right. Which, based on your summary, might be some time away.)

Have them make a branch off of each bit of work from the same starting point for each ticket they work on. Have them merge the work to a RC branch. You can merge your work to the RC branch. This will allow you to test often. See the workflow we have here:

https://plus.google.com/109096274754593704906/posts/R4qkeyRadLR

Let me know if you have any questions about it. It works well for us.

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