Git rebase10/4/2023 ![]() # Rebase 4bdbfef.e772fe9 onto 4bdbfef (2 commands) Your shell would look something like this: pick 64794ce second hello The -i flag stands for interactive the rebase opens an interactive vim editor where you can not only rebase to the second last commit but alter the commit history up to that point in the process as well. Enter the following command: git rebase -i HEAD~2 Now, you want your branch to reflect the second last commit that has the commit message, “second hello”. Then, we do a series of commits, where we edit the file example.txt. The above code creates a folder example and initializes git inside the folder. My colleagues noticed that I communicate much better through my commit history, and I am happy for their help with my journey with rebase.Let’s see git rebase -i HEAD~n in action: mkdir example Overall, I can say that everything is more pristine and nicer with rebase. I can keep commits clean and make the feature branch history readable and reviewable. Start small, start with interactive rebase to fix up a commit or something tinyĪfter getting familiar with rebase, I've noticed I use it very often, and it is part of my work now. ![]() ![]() Saving your changes will help if you messed up a rebase and the rebase finished, you can still pull from your feature branch origin and start rebasing again
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |