Majority of my experience with Git has been via the command line. As you may know, Git was created by the same person that created Linux, Linus Torvalds. Thus it should be no suprise that the primary way of using Git is with the command line.
When I started doing work that involved coding in C# (C-Sharp), that meant that I had to become familiar with Visual Studio. Mind you, I had not seriously used Visual Studio in several years. The last version I remember using was Visual Studio 2012. At the time of this writing, Visual Studio 2019 is the current version. In addition to the learning adjustment that I had to do for using the 2019 version of it, I also had to figure out how to use Git within Visual Studio. Let's just say that it was not that easy coming from years of working with command line.
My particular work setup was not configured so that I can use Git Bash from the command line, terminal, or Package Manager Console within Visual Studio. Thus I have no way of manually running the commands that I am familiar with when it comes to Git and had to learn how to navigate a GUI version of Git.
You Can Still See That?
I was working with another developer on some code and mentioned that they could check out my branch to see what I had done. They asked whether to checkout the July branch or the August branch. Now I knew that I had deleted the July branch from the server and from my local repo, but was puzzled when they inquired. Afterwards, I double checked the server and sure enough it had been removed, yet they were still able to see it.
Come to find out, when you do a sync of the origin (the server side) to your local in Visual Studio 2019, it does not remove the branches that no longer exist by default. Thus you end up with stale branches taking up space on your computer that probably have no use.
There Is A Setting For That
I did a bit of online research to see if something was wrong. Come to find out, there are many of posts and message board questions about how to address this. For Visual Studio 2019, there is a setting that has to be changed in order for it to remove the old branches that no longer exist on origin.
By default, this setting is set to "Unset". This is similar to the equivalent of setting a boolean value to "null" (which should not and in some languages cannot be done).
To change this setting, you will need to do the following.
- Open Visual Studio 2019
- Go to the Team Explorer window
- Settings (via the home)
- Change the "Prune remote branches during fetch" option to True
- Save and close
After you change this setting, each time that you do a fetch or sync, the branches that are no longer on the remote will be removed. In my opinion, I think that this needs to be the default behavior as it keeps your repository smaller and cleaner.