Avoid unwanted merge commits and other commits when doing pull request on GitHub

前端 未结 5 809
萌比男神i
萌比男神i 2021-01-31 10:10

I forked a project on Github.

Let the remote upstream be upstream and my remote repository be origin. My local master branch is se

5条回答
  •  说谎
    说谎 (楼主)
    2021-01-31 10:15

    If I understand your question, you want to get rid of the intermediate/throwaway commits that you did in your branch. Try something like this:

    git checkout -b for-upstream remotes/origin/master (create a new branch from the upstream origin)
    git cherry-pick  (fix any conflicts if necessary)
    

    this should give you a local "for-upstream" branch which contains just the upstream master + your 1 commit. You can then submit that branch for pull request

提交回复
热议问题