Remove commit clutter with Git Rebase

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.  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.  Take for example, the history that is show on my TFS Team Project that uses Git for source control:


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. 

The way that you can remove the clutter is by using git rebase, which allows you to squash multiple commits into a single one.  So in effect, you are changing history by combining a lot of commits together. 

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.


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):

git rebase -i origin/master

This brings up a VIM editor that shows all the commits that I’ve made locally and have not been pushed to the origin.  You could also do this when merging between local branches.


I then change the “pick” to “squash” on my 2nd and 3rd commits.  This tells Git that those commits should be squashed into the first commit:


To save and exit, hit Escape, then :wq

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. At that point, you can change the commit messages before the rebase completes.  Saving that file the same way as we did before with :wq, gives you the results that you were looking for:


Now, back on Visual Studio, you can see that my 3 commits have been changed into a single commit:


And my commit details show my 3 commit messages combined:

And once I push my changes to the server, I see a single commit:


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.  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.

If you want to get started with Git and be successful with it, while staying in Visual Studio, I created a Pluralsight course that you may want to check out: Git for Visual Studio Developers.

About esteban

Esteban is the Founder and Chief Technologist at Nebbia Technology, an ALM consulting and Azure-powered technology company. He is a software developer with a passion for ALM, TFS, Azure, and software development best practices. Esteban is a Microsoft Visual Studio ALM MVP and ALM Ranger, Pluralsight author, and the president of ONETUG (Orlando .NET User Group).

10 thoughts on “Video: Sprint Planning with Visual Studio Online

  1. sanjeev

    Is this possible through MTM2013 using TFS2010 ?

    1. esteban

      No, this is a TFS Feature not an MTM feature, so you need TFS 2013

  2. Bruce Cutler

    When I select Test Case chart, nothing appears in the Group by drop down. Why not?

  3. Bruce Cutler

    In reference to test case charts in tfs 2013 update 4:
    When I select Test Case chart, nothing appears in the Group by drop down. Why not?

    1. esteban

      Bruce, make sure that before you try to do charts, you go to the Test tab, then click on Column Options, and add the columns that you want to group by. The charts only act on the data that is displayed on the grid.

  4. Anil Yadav

    Is there any way to update string in test steps of multiple test cases in one go, like ctrl+h?

  5. Dave

    I thought that packages restored to the C:\Users\{user}\.dnx\packages directory? I don’t have the test adapter DLL in my bin folder. In fact, I don’t even have a bin folder.

  6. Slawek

    Did anybody have the following error:
    Exception discovering tests from Test1: System.BadImageFormatException: Could not load file or assembly ‘C:\a\ff22bda8\xunit\Test1\Test1\bin\Debug\xunit.execution.desktop.dll’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

  7. yos

    hi to all,

    I would like to configure the charts more the 9 CR’s , can I ?


  8. Elizabeth Britton

    I received word that you are enjoying utilizing Syncfusion’s free product offerings. I wanted to reach out and see if you were interested in becoming a guest blogger for Syncfusion. By providing your story, you not only create exposure for you and your company, but an avenue to showcase your application to the developer community. From this mutual support, we learn more about developers like yourself and how you use our flexible controls to create these outstanding applications.

    Please let me know if you are interested in creating a blog post about your experience with Syncfusion’s products.

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you human? *