I'm using the following workflow for project on Github.
master
to forked master
master
and implement something master
master
. The problem is 2. At first I wasn't expierenced with git, so I did this via the pull request in my fork. Now I do git pull upstream && git merge upstream/master
, which creates a new merge commit. After some such merges, my PRs looks like this:
As you see, there is a bunch of merge commits. It's really ugly, and it may be quite hard to understand what exactly I want to merge. Moreover, this list grows every time I merge base master
to my fork.
Is there a way to hide/remove them? At this moment, I can only consider deleting and re-creating fork every time PR is done, but that's not good, because I may work on A, then switch to B, merge B, go back to A etc. git rebase
actually doesn't hide them: merged commits are listed in PR with $user authored and $me commited
.
To fix your currently "broken" PR, you can squash all your commits into a single commit. You can do this on the command line with git rebase -i
, and changing pick
to squash
on all but the first commit.
GitHub actually implements this for you as well - if you click the dropdown next to the Merge pull request
button, there is an option for Squash & merge
, which does the same thing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.