![]() ![]() 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. 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.
0 Comments
Leave a Reply. |