
The Visual Studio Git tools will continue evolving so expect that you will need to jump out of the IDE with less frequency as time goes by. Yes, I know that it’s a bit of a pain to jump out of your IDE to do this, but once you do it a couple of times, it’s pretty straight forward. Now, back on Visual Studio, you can see that my 3 commits have been changed into a single commit:Īnd my commit details show my 3 commit messages combined:Īnd once I push my changes to the server, I see a single commit: Saving that file the same way as we did before with :wq, gives you the results that you were looking for: At that point, you can change the commit messages before the rebase completes. Git will show you a status letting you know that it is rebasing, and then you are presented with a new VIM editor showing you your three combined commit messages. This tells Git that those commits should be squashed into the first commit: I then change the “pick” to “squash” on my 2nd and 3rd commits. You could also do this when merging between local branches. This brings up a VIM editor that shows all the commits that I’ve made locally and have not been pushed to the origin.

To do so, you’ll need to jump out to command-line and enter this command (Note that I have msysgit installed, with command-line integration): In this example, I made 3 commits to the same file, but when I push my changes, I want my team to only see one commit. So in effect, you are changing history by combining a lot of commits together. The way that you can remove the clutter is by using git rebase, which allows you to squash multiple commits into a single one. I had 6 commits in a span of 1/2 hour, and my team can probably do without seeing every single one of those commits in history.

Take for example, the history that is show on my TFS Team Project that uses Git for source control: When pushing your changes to the shared repository, you may not want to show all your changes in history, as this can turn into a lot of clutter, especially if you are committing every few minutes. One of the biggest reasons to user Git, is the ability to commit often without affecting the rest of your team since you are committing locally.
