How to use Microsoft's GVFS with gmaster

Thursday, December 14, 2017 73 Comments

By the end of this post, you will have Microsoft's GVFS up and running on your PC, and be able to use it with gmaster, your favorite (I-hope-so) Git client.

Size comparison between a full clone and a GVFS clone

The cool thing about GVFS, in case you didn't know, is that you can now have large Git repositories on your PC, -even the ones too big for your hard drive-, while the operations on it are still super-fast, regardless of its size.

This is because you won't really have the entire repository on your PC. GVFS, short for Git Virtual File System, will silently download on demand the necessary files to your PC, just when you or any other program on your PC require them. You can read more about how GVFS works here (you'll see our logo at the bottom!); this post is just a guide to get you started with GVFS and gmaster.

By the time I'm writing this, GVFS requires a computer with Windows 10 1703 (Creators Update, released on April 2017) or later. Because it also requires a service that supports the GVFS protocol, for now you are restricted to using Visual Studio Team Services if you want to try GVFS, although other big players in the field, such as GitHub and BitBucket are working to bring GVFS support to their platforms, and GitHub is working with Microsoft to bring GVFS support to GNU/Linux and macOS.

Are you ready? Ok, let's go!

Installing a GVFS-enabled Git on our computer

First things first - to interact with GVFS both from command line and from gmaster you need to download the GVFS-enabled release of Git for Windows, and the GVFS utility itself. Both are available for download from Microsoft's GitHub repositories, under the "releases" section. Download the latest release available of each when you read this:.

If you want to, you can also download the GVFS source code and build it from scratch, but that is out of the scope for this guide.

Installing both programs is now easy (not so long ago was truly a hassle), so I'm not going to walk you through the installers. Click next, next, next... next, and you are done!

Once you have them installed, you need to set the core.gvfs config flag to true:

git config --global core.gvfs true

You are almost ready to go; now you only need a Visual Studio Team Services (VSTS) repository!

Setting up VSTS

For those of you who don't know, if you have a Microsoft account (I still have my original Hotmail email account!) you can have a free Visual Studio Team services account.

Team Services is a platform that reunites different tools such as Git (of course), but also agile tools, continuous integration, release management, etc. You can check it out here. Because Team Services has a free tier, it is the perfect all-in-one platform for the solo developer, or for small teams with a reduced budget. For us, it was perfect because at the time it already supported GVFS.

After going to the Visual Studio Team Services home page, and creating your own VSTS account, you will be prompted to choose a few settings. You can change your first project name, the region where your projects will be stored, and another few settings, but the important thing is that you keep Git as your VCS:

Creating your own VS account

If you already had a Visual Studio Team Services account, you can start a new project from it to test GVFS. Again, the only thing you need to ensure is to select the Git option for Version Control:

Creating a new project using Git and Scrum

For this demonstration, I chose a medium-sized, public repository (the MonoDevelop one), to show you how easily you can use GVFS with preexisting repositories. I cloned it to my hard drive with a regular git-clone, and I modified its .gitattributes file to enable GVFS on it. According to Microsoft's instructions, you only need to add the line "* -text" (without the quotes), and you are good to go.

Modifying the .gitattributes file

Then, I pushed it to the GVFS-demo project's Git repository I just created on VSTS, adding a new remote with the URL of the Git repository (something like https://myusername.visualstudio.com/_git/GVFS-demo, or ssh://myusername@vs-ssh.visualstudio.com:22/_ssh/GVFS-demo if you chose SSH over HTTPS) and doing a regular git-push. Please note that, so far, GVFS is not involved in the process. I just prepared a local, full-size repository with a regular clone, and uploaded it to VSTS with a regular push.

By the time I was done, my VSTS demo repository looked like this:

My demo repository at VSTS

Finally, we are ready to work with this repository using GVFS.

Using the repository with GVFS

Now, it is time to clone the repository using GVFS. To do so, execute the following in a terminal:

gvfs clone https://myusername.visualstudio.com/_git/GVFS-demo
If you run into the "Could not load file or assembly 'GvLib.Managed.dll' or one of its dependencies" error while executing the command above, you must solve it installing the MSVC++ redistributable. Note, if you use Visual Studio, you probably have it already installed. You can find out more about this issue here on GitHub.
Successfully cloning my repository with GVFS

Your repository's content will be located inside a directory named src inside the destination location you chose for the clone. This is because of a design decision from the GVFS team, and you can learn more about the why and the how about it here.

With the repository cloned and mounted, we can now open gmaster and add it! If you wait a little bit, it will be automatically detected by gmaster. If not, you can directly browse to it and add it to your repositories list.

gmaster will correctly show you the Branch Explorer of the repository. You can diff any commit you want, or check it out, create branches and tags, check the pending changes, and commit and stash them, and, of course, push and pull the work of you and your colleagues. Long story short, with gmaster you can work with a repository mounted with GVFS as easily and effectively as you can with "regular" Git repositories.

A complete Branch Explorer in a repository mounted in GVFS

If you open the directory, you can check that every file is where it should be. But, if you use the Explorer to check the size of the directory, you can see that it is much smaller than a full checked-out workspace, saving space and making big repos locally manageable (which was the initial purpose of this post!)

Size comparison between the original repository and a GVFS cloned one

GVFS will download the files on-demand, when they are required either by you (for example, opening them manually from the Explorer), or by a program (for example, Visual Studio while building). If you use most of the files continuously, this is OK, but for example once you did a complete build, leaving your workspace with a bunch of files that you won't need again anytime soon. You can dehydrate or clean up your GVFS repository executing:

gvfs dehydrate GVFS-demo --confirm

This command will backup your src directory (just in case), and create a fresh, fully dehydrated copy of the repository. You can safely remove the backup src directory, but keep in mind that this feature is (according to the docs) experimental!

Once you are done working, you can unmount your repository the following way:

gvfs umount GVFS-demo

Remember, that before working again on that repository, you will need to mount it again!

Conclusion

I wish you a happy gmastering with GVFS! If you have suggestion, doubt or problem, please don't hesitate to leave a comment, or ping us on Twitter at @gmasterscm.

Enjoy!

We develop gmaster, a Git GUI with semantic superpowers. It parses the code to really understand how it was refactored and then diff it and merge it as a human would do, matching methods instead of lines.

If you want to try it, download it from here.

We are also the developers of SemanticMerge and Plastic SCM, a full-featured version control.

73 comments:

  1. It is interesting to read your blog post and I am going to share it with my friends.aybabg

    ReplyDelete
    Replies
    1. Great Article Cyber Security Projects projects for cse Networking Security Projects JavaScript Training in Chennai JavaScript Training in Chennai The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Support is available for all the lines of Microsoft products including Windows 7, XP, Vista, Office, Windows Server, Outlook, or Internet Explorer etc. reset windows 10 password

    ReplyDelete
  3. Your logo should put over an unmistakable message to potential clients about your business, items and administrations and in doing as such guide their basic leadership with regards to acquiring from you.
    logo design service

    ReplyDelete
  4. some in strive for of truth terrific squabble out going in the location of for behalf of the proprietor of this net website online , perfectly ultimate articles . Couldn’t stream office 30015-25 (3)

    ReplyDelete
  5. Thanks for sharing such a nice Blog.I like it.
    renew norton

    ReplyDelete
  6. that is a big article thank you for sharing this informative recommendation. i'm able to visit your weblog often for a few modern day call. i'm able to visit your blog regularly for a few today's say. Windows 10 Pro Keys Office 2019 Professional Plus CD Keys.

    ReplyDelete
  7. This type of message always inspiring and I prefer to read quality content, so happy to find good place to many here in the post, the writing is just great, thanks for the post. windows iso

    ReplyDelete
  8. Thanks for sharing such a nice Blog.I like it.
    McAfee Phone Number

    ReplyDelete
  9. Such audits provide them the insight they need to ensure that their Active Directory is adequately secure at all times. windows 10

    ReplyDelete
  10. Awesome blog ,Thank you for sharing such a nice blog.
    webroot safe

    ReplyDelete
  11. I am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work. Microsoft CRM Credit Card Processing

    ReplyDelete
  12. I got too much interesting stuff on your blog. I guess I am not the only one having all the enjoyment here! Keep up the good work. 상품권 매입

    ReplyDelete
  13. Thanks for sharing such a nice Blog.I like it.
    Webroot Complete Key

    ReplyDelete
  14. Thanks to share with us i was looking for. That is really helpful for me.

    Regards.
    Office Support

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. Very good post, keep sending us such informative articles I visit your website on a regular basis.
    fall nail colors 2019

    ReplyDelete
  17. Crack software! Here at Crackzoom you will get all your favorite software. Our site has a collection of useful software. That will help for your, Visite here and get all your favorite and useful software free.

    ReplyDelete
  18. Highly Compressed Pc Games
    Its a game site with the collection of cool action games.Get all your favourite games here.

    ReplyDelete
  19. It is the kind of information I have been trying to find. Thank you for writing this information. It has proved utmost beneficial for me. Microsoft Office crack

    ReplyDelete
  20. Smart Driver Updater Crack Incl Full License Key level motorist updater crucial is one of a number of those brightly constructed PC applications which thoroughly scans the monitor for absolutely any aged drivers also mechanically upgrades the drivers inside one click on.New Crack

    ReplyDelete
  21. Best Corporate Video Production Company in Bangalore and top Explainer Video Company in Bangalore , 3d, 2d Animation Video Makers in Chennai
    Your article is awesome!! Really helpful to filmmaker wannabes. 🙂 Cheers!

    ReplyDelete
  22. Pretty good post. I have just stumbled upon your blog and enjoyed reading your blog posts very much. I am looking for new posts to get more precious info. Big thanks for the useful info. 2ms office 2016 product key

    ReplyDelete
  23. I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy. microsoft office 2016 free download full version

    ReplyDelete

  24. Ccleaner-Pro Crck free download is a useful utility for computers with MS Windows. That cleans out all those junk that accumulates over time like broken shortcuts, temporary files, and many other problems. It is the best tool for cleaning your computer. As It makes your system work smoothly and fast. It also secures your system and protects your privacy.
    IDM Crack Setup

    ReplyDelete

  25. abbyy-finereader-corporate-crack is the best way to edit and organize your PDF file. You can also protect and sign PDF files with Abbyy Finereader crack. Then, if you also want to edit, read, and erase the PDF file easily. Then you can try this program which is a really good program. It can also save you a lot of time. It comes with lots of nice and fast tools too. If you like this program and want to get it.
    Free Pro Keys

    ReplyDelete
  26. Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. download windows 10 product key

    ReplyDelete
  27. I read a article under the same title some time ago, but this articles quality is much, much better. How you do this.. download windows 10 product key

    ReplyDelete
  28. I will really appreciate the writer's choice for choosing this excellent article appropriate to my matter.Here is deep description about the article matter which helped me more. funny instagram username

    ReplyDelete