
However the branch has changed, the red commits will be added onto the new HEAD of your branch.Ĩ) Git is going to apply the commits one by one. Now git will apply them back on the branch. From git point of view, since your branch contains all the blue commits from develop, it's just like if your branch was started from the current HEAD, and not the old one, two commits before.ħ) It is now time for git to bring back the red commits put aside. Git is going to bring the latest changes of develop into your branch.Ħ) This situation is now equivalent to having started your branch from the latest commits. This is the first main concept behind the rebase. The branch looks like it went back into the past.ĥ) Git is going to bring the new blue commits of the develop branch inside your branch. Your red commits are removed from the branch. First, it will take all your commits and put them aside, like this: But what does it mean ?Ĥ) When you start the rebase, git is going to modify your branch. The solution is consequently to "rebase your PR on develop". Rebasing the branch used to create your PR will resolve the issue preventing the merge.

If for example the 2 new blue commits on develop modify a file also modified by your PR, then this might introduce a git conflict that prevents the merge of your PR.Īnd this is it: your PR cannot be merged.Īt this point, one project maintainer is likely to ask you to rebase your PR on top of the targeted branch. Whatever the circonstances, while your PR was idle, the work on the main repository continued! Other Pull Requests were merged, which means new blue commits were added on develop branch.ģ) Unfortunately, because a Pull Request always target the latest commit on targeted branch, it might not be mergeable anymore. Maybe you got feedbacks and could not handle them sooner because you were busy.
Github desktop rebase free#
Maybe it needed some advanced exploration and testing to make sure it was free of bugs. Maybe it needed some adjustments, required by the maintainers. However your PR was not merged immediately. Your PR could have been merged without issues. Your Pull Request goal is to merge the 2 red commits into the develop branch.Ģ) At the time you created your branch, everything was fine.

Your branch my-branch is issued from the last blue commit, the HEAD of develop. The blue commits are the develop commits, the red commits are the commits you added on your branch. Here is a small graph presenting the situation: We'll say the main branch is called develop and your branch is my-branch.

This branch was issued from the repository main branch HEAD, the latest commit available on the main branch. How did we end up here ? Here is probably what happened :ġ) In order to create the PR, you forked the main repository and created a branch of yours. This will be indicated by GitHub as such:Īnd even if your PR meets all the other criteria to be merged, the merge cannot happen. This can happen for several reasons, the most frequent one being that files modified in your PR are in conflict with changes that have already been merged. However it might happen that your PR (Pull Request) becomes out-of-date. If you are reading this, congratulations! Because it means you have submitted a Pull Request to an open source project hosted on GitHub and that is already remarkable. The main idea however should be accurately presented. Please note that, in order to make this post accessible to people still not comfortable with git concepts, I will simplify and twist a little how git rebases work, in order to make them easier to understand. you need to rebase one Pull Request you have submitted and you do not know how or why.you are willing to contribute to an open source project hosted on GitHub.So I'll continue this post while considering that

It does not explain "how" (this part has been addressed already by multiple posts, you'll find links about this at the end) to perform the rebase but rather what happens behind the curtain and why it is needed. This blog post is intended to help people willing to understand what it means to rebase a Pull Request submitted on GitHub.
