![]() ![]() Rebase compresses all the modifications into a single patch. During an interactive rebase, when Git pauses at a commit you tagged to edit, the workflow is no different than a normal commit process - you stage files and then commit them. The other way is using the rebase that I’m going to show you now. Git Rebase - Another way to integrate modifications from one branch to another is by Rebase. There are a few ways to update the current branch, one of them is using git merge and merging the most updated branch, in this case main, into the branch you want to update in this case task-2. Knowing that main is more up-to-date than your branch task-2 and following the good practice of always working with the most up-to-date project, you decide it’s time to update your working branch, which has the current history looking like this: Similarly, the history graph should look like the image below: Suppose you have a project and you were working on a task on the branch task-2, meanwhile someone else was working on the branch task-1 that was merged into main and thus making the branch main more up-to-date as shown in the drawing below: Taking no action is a valid choice, but at least one commit must be marked as the one to squash, or the rebase is functionally meaningless. The commits to rebase are previously saved into a temporary. It provides a list of commits, and then you choose what actions you want Git to take on each of them. In a nutshell, git rebase takes the commits of a branch and appends them to the commits of a different branch. In Git, the term rebase is referred to as the process of moving or combining a sequence of commits to a new base commit. ![]() ![]() In this pro tip I will show you how to use git rebase to update a branch. The git rebase -i interface is, as its long form -interactive flag implies, an interactive interface. The command git rebase can be used to make various history adjustments, from rewriting the commit tree (and by doing that rewriting the history) to even pushing commits forward as if the branch were created in the future. ![]()
0 Comments
Leave a Reply. |