With visual studio online, you can easily host your code in the cloud,
access it anywhere and support a variety of development platform. You can
easily setup the cloud infrastructure using VS online in a couple of minutes
without having to setup the server infrastructure. It also allows you to choose
the version control system to host the files (Centralized – TFS or Distributed –
Git), manage the project in the cloud by planning and tracking work items with
fully integrated tools for agile planning and portfolio management.
To create a project and create a master branch in Git, you
can create a new repository at a file location either by using the Git Bash or
Git Extensions as given below.
Once the repository is created, you can now go ahead and create
a project in visual studio at the location. You can also choose to host the
site on cloud if needed and test the application.
After creating the project, next step is to add the files to
the repository. You can use the git add command to add the files to the repository
before committing it. Its also good to add a .gitignore file to the repository
to mention the details of the files that you don’t want to include in the
repository.
If you check the status of your repository at this point. It should look something like:
Once the git ignore file is created, you can add and commit
the files to the master branch using the "git add ." and "git commit -m "my commit message"" commands
After commit your repository structure should look like
Once you have your master repository created in your local
machine, you can now setup a remote git repository by using the command.
git remote -add origin "your vs online project url here"
To create a VS online account, you can either use the Azure
management portal or use the Visual studio online website. I've used my Azure
portal to manage my VS online account.
After successful creation of the account, you can create a new
project in VS online and use the version control of your choice as given below.
To push the local repository contents to this remote
repository, you need to use the git remote command and then push the contents
to the remote repository.
Once published, the source code can be viewed from your VS
online profile.
Next we’ll see, how to branch this, create builds, tests and
deploy to Azure all using VS online.