If you’re using Sourcetree, you can try this tutorial:Īll the commands are executed in the Terminal app on a Mac, commands on another platform might be slightly different. Nevertheless, if you think Git’s interactive rebase is an interesting feature, but you don’t want to use the command line, you can also use your Git GUI client. But fear not, it’s fairly intuitive and I will explain the process step by step. We will see how to use the interactive rebase feature on the command line. Therefore, it is highly recommended to only use the interactive rebase function on your local commit history, before you push it to the remote. Using interactive rebase on your commits does not edit them, but creates new commits instead. Anyone, including yourself, who will have to look through the old commits at some point in the future will be grateful for that. Having a clean Git commit history sounds great, but what is the benefit of investing the extra effort? Well, besides the aesthetics you get a semantically correct and meaningful commit history, which will be easier to understand. Edit your commit to add or remove changes to/from it Squash two or more commits into a single one Split one commit into two or more commits In this tutorial article, I will show how to use interactive rebase to: You may want to do this if you branched off your branch from master a while ago and now want to base your branch on the current state of the master branch to discover possible conflicts and issues before the actual merge back into the master branch.Īn interactive rebase, however, let’s you clean up your commit history from flaws and silly oversights, which you often only spot in hindsight. Maybe you have heard of Git rebase before and you’re wondering what the difference to an interactive rebase is.Ī normal rebase let’s you reapply the commits of your branch on a different base commit. This is where Git’s interactive rebase feature comes to the rescue. When looking at them after a while we often realize that we have a spelling error in our commit message, it took us several commits to correctly implement a certain feature or that we mixed changes from a feature and a bug fix in the same commit. Nevertheless, these commits are often not as clean and perfect as we wish they would be. Every time we are satisfied with the state of a logical chunk of code, we create a commit containing our changes. Luckily, with version control systems like Git, we can decide ourselves when we are happy enough with our code to share with our team or the rest of the world. During development, we frequently have commented or unused chunks of code, spelling errors, or even logic errors in our code. Software development is often a messy process.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |