Customizing a SharePoint Master Page is easier with SharePoint Designer when compared to provisioning a customized Master Page via Visual Studio. But if you would like to know how to bring it back to Visual Studio, follow the procedure to roll back the changes performed in a Master Page.
I have developed a custom master page and deployed it in SharePoint 2010 and set as a default master page with Feature. The Custom master page while provisioned in a feature will be stored in %Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\<feature name> folder.
Whenever, I created a new site, the feature receiver automatically sets this Master Page as a default master page. By default, SharePoint loads the master page from 14 hive folder until it’s edited through SharePoint Designer.
For some reason, if you have customized the master page in SharePoint Designer, SharePoint stores a modified version of the master page in the content database and it ignores the file deployed in 14 hive. This process is called as Unghosting. This process breaks the reference of the master page file on the 14 hive.
If you would like to perform any changes to your Master Page after you have unghosted , the only option possible is to perform it with SharePoint Designer. If you would like continue the changes to be performed with Feature deployment you have to roll back the changes performed in the master page and reset it to its original state.
Note : Ensure that you have performed all the changes that you have performed with designer is updated in your newly deployed Master Page, else you will lose all the changes that you have performed with SharePoint Designer.
To roll back the changes, select the Master Page that you have customized in the SharePoint Designer. This would enable the “Reset to Site Definition” button in the Ribbon. Click that button. This would create a copy of that Master Page and resets the Master Page to the last deployed version (deployed via Feature.)
After doing this, I have deployed the custom master page feature and it’s working as expected.