简体   繁体   English

GIT:当我已经提交到master分支后,如何发出请求请求?

[英]GIT: How can I do a pull request when I've already commited to my master branch?

My remote repo's master branch looks like this (each one is a commit): 我的远程仓库的master分支如下所示(每个分支都是一个提交):

A - B - C - D - E - F - G A-B-C-D-E-F-G

I would like to get a code review that diffs C and G (C's changes from B should not be displayed). 我想获得一个对C和G进行比较的代码审查(不应显示C对B的更改)。 How do I do this? 我该怎么做呢?

Do I have to 我一定要吗

- create tmpBranch at master (pointing to G)
- branch from C (newBranch)
- move my master branch to newBranch
- delete newBranch
- push these branch changes to repo
- submit pull request

or is there an easier approach? 还是有更简单的方法? If no, what are the commands that will do the above? 如果不是,执行上述命令的命令是什么?

Branches are just labels to the HEAD commit. 分支只是HEAD提交的标签。 So, you essentially just need to change the labels. 因此,您基本上只需要更改标签。

It's not a good idea to change public history, unless your repo is your own. 除非您的回购单是您自己的,否则更改公共历史记录不是一个好主意。 So, I'm assuming nobody uses your master branch. 因此,我假设没有人使用您的master分支。

$ git checkout G
$ git checkout -b review-this         # Create the branch to be reviewed.
$ git checkout master
$ git reset --hard C                  # Reset the master to commit C
$ git push -f <remote-name> master    # Force push the master branch
$ git push <remote-name> review-this  # Push the new branch
# Submit the pull request

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Git-拉取请求后,我的本地master分支会怎样? 如何管理多个进行中的分支? - Git - What happens to my local master branch after a pull request? How do I manage multiple in progress branches? Git:我忘记创建分支 master,如果我的存储库已经有另一个分支,我该如何创建它? - Git: i forgot create branch master, how i can create it if my repository already has another branch? Git:提交到我的master分支,我打开了pull请求,但现在无法实现新功能 - Git: made commits to my master branch i opened pull request and now can't implement new features 如何使用 git 从 master 分支中拉取? - How can I pull from master branch with git? 如何从主分支向暂存分支发出拉取请求? - How do I make a pull request from the master to the staging branch? 在 GitHub 上合并拉取请求后如何同步我的本地主分支? - How do I sync my local master branch after merging a pull request on GitHub? 我将我的工作提交到了 Git 上错误的分支 - I commited my work to the wrong branch on Git 如何使用 git 将 URL 获取到我当前分支的合并请求或拉取请求? - How can I get the URL to a merge request or a pull request of my current branch using git? git-如何撤消合并到主请求中的请求 - git - How do I undo a merged pull request into master git pull到我的分支,但是不覆盖任何本地文件(我已经将它推送到了原始文件/分支) - git pull to my branch but do not overwrite any local files (that i already pushed to origin/branch as well)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM