![]() It's completely safe because you don't change git history you simply transformed all commits from feature branch to single commit with squash. Git commit -m "Implemented other-feature"Īnd this is it with merge. Let's say that we create a first commit on master So here I'm in master with no commit yet. It is completely safe and it will just melt all your commits from feature in a single commit. If you still want to squash you commits I can recommend only doing squash commit with merge when you are merging your feature branch in the master. Especially if you are not digging in git history too often. Of course cleaner naming is better but people can live with both of them. I saw projects with both clean history and naming of commits and not so clean. Just forget about squash and especially squash with rebase. Merge won't override history and rebase will.īut at the beginning I want to mention an easy of working for you with git. ![]() And they have exactly the same pros and cons like just using merge and rebase. Now the question is how to do that? It is possible to do git squash with merge and rebase. If you commited several times with not logical commit but just to commit your changes or you didn't plan chunks of your feature than probably you want to improve your commits or squash them into single commit. But of course it's not always possible to do that. Then it's easier for reviewer to check the PR by commits and not like a huge blop. And then for every local chunk we create a commit. And you need to try and split your feature in logical chunks of code like for example implementing core, adding UI, using created component everywhere. The question is why do you need something like this? So normally when you develop some feature you created a feature branch from master and are working there. So what is squash in git? It's a process when you take several commits and make single commit from them. Just to sum up the previous video - always use merge and not rebase because it's save and do are not override git history. ![]() So if you didn't see my video "Differences between merge and rebase" I highly recommend to check if first. So squashing commit goes a lot in direction of differences between merge and rebase. In this video I want to talk about one useful git feature which is squashing commits. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |