Git squash commits8/12/2023 ![]() ![]() We can see in the log the first four commit messages signifying the operations of deleting different irrelevant files. git merge -squash using the -squash option while merging Using Interactive git rebase Tool to Squash Git CommitsĬonsider the following git log excerpt, which shows the last four commits from HEAD that we are interested in squashing.git rebase -i as an interactive tool used to squash commits.There are two ways to achieve Git squashing: Please note that there is no git squash command. Here too, we may want to squash the various commit messages done in the feature branch into one when merging into the main branch. Usually, we create a feature branch from the main branch for some feature development.Īfter feature completion, we merge the feature branch into the main branch. After a while, when we reach a satisfactory state, the many commit messages clutter up the git history.Īt this point, we may want to combine the different commits into one so that the git history looks clear and best reflects the task done.Īnother use case is to do squashing while doing branch merging. Thus, doing this makes the git history look concise and clear.Īnother way of looking at it is that we do multiple commits related to some task. ![]() The main intention is to condense many commits to a few relevant commits. The basic idea is to take multiple continuous commits and squash them into one. We will learn Git squashing in this tutorial. Using git merge -squash to Squash Git Commits.Using Interactive git rebase Tool to Squash Git Commits. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |