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

前端 未结 5 816
萌比男神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:38

    Instead of merging you want to rebase. You can do this manually, or automatically when pulling.

    git pull --rebase upstream master
    git push --force origin master
    

    Once you've started doing merges though this will get hard to do, you'll need to reset the branch back to before you did a merge commit.

提交回复
热议问题