![]() Therefore when merged into the deployed branch of the repository, your feature code should appear neatly as a single commit. In the eyes of the project manager, your pull request implements a single feature. So by the time you are done writing the code and testing it in development, it makes sense to combine (or “squash”) all the commits you’ve made since branching from the upstream branch (eg. The idea of a feature branch is that it contains code that implements a particular feature. ![]() If you’re working with a team of developers, merging all these commits into master branch may not be useful and may make the project’s commit history unpleasantly long.Ī little more on this. ![]() Depending on your work style, you might have anywhere between 1 to 50 (or even more?) commits in a local feature branch. Squashing git commits is technique useful for working with teams. Photo by Vance Osterhout on Unsplash Why bother to squash git commits? Note before proceeding: I use Terminal on a Mac and the commands below are based on that. This post focuses on squashing commits on the command line. This process is simple if you’re using a remote like GitHub, which can be done with the click of a few buttons in the Pull Request UI. In this short post, I’ll demystify the process to squash git commits from the command line.
0 Comments
Leave a Reply. |