Can I clone a single git branch in Visual Studio? - visual-studio-2017

I have a TFS git repository which takes a long time to clone. Is there a way to only clone a single branch in Visual Studio?

If you are using Git CLI, you should use (in a CMD or PowerShell instance or any other terminal-like client of your preference):
git clone -b branch_name --single-branch 'repo_url'
branch_name: is the name of your branch.
repo_url is the link of your remote repository.
This will import a specific branch from your remote repository.
According to this, you need to know that Visual Studio just read your .git (and other Git dependencies such as gitignore, gitmodules, etc) configuration.
Considerations:
This works only with git 1.7.10 version and above.
References:
Visual Studio 2017 Branching MSDN documentation
Similar question

Related

GitHub repository created but unable to upload VS solution

I tried uploading a C++ project from Visual Studio 2019 onto my GitHub account.
The repository gets created when I do this however, none of my codes gets uploaded onto the repository.
Only the files ".gitattributes" and ".gitignore" appear in my repository.
Please could I have any suggestions on what I could do to fix this.
Close VS
Go to your local repository folder (the solution folder)
This will add all the files and commit them
git add .
git commit -m 'added files'
alternatively you can use "git add ___" to add one file at a time
Make sure you commit the changes and then do
"git push"
Re-open VS and everything should be setup now.
Here are some other instructions I wrote down recently which you may find helpful:
How to create a git repo from an ungitted local project already in development:
Create a empty repo on your repo hosting site
Go to your local project folder in git command line
git init
git add .
git commit -m 'message'
git remote add origin https://yourreposite.com/username/repo
git push -u origin master
Now you can open it in Visual Studio and everything is all setup

VSTS: Store zip files from build for usage across builds

I am working on a series of builds. There are intermediate files created from few builds and other builds use those files in their build process. The build processes are scripted in PowerShell scripts. We are using private agents as there are custom dependencies.
Currently, we are using a folder on the private agent to store the intermediate outcomes that we refer to in the dependent builds.
We wish to keep it on VSTS (might be as a zip file) and download and unzip to a folder when we build the dependent component.
We see nuget etc. to be not fitting to the requirement.
Is there any available option for it?
If you want to store files in VSTS instead of the local agent machine, you can store the files into a separate repo hosted in VSTS.
Such as to store a zip file ($(Build.SourcesDirectory)\my.zip) into VSTS git repo (https://account.visualstudio.com/project/_git/filestore), you can execute below PowerShell script during build:
git clone https://Personal%20Access%20Token:PAT#account.visualstudio.com/project/_git/filestore
Copy-Item $(Build.SourcesDirectory)\my.zip $(Build.SourcesDirectory)\filestore
cd filestore
git add .
git commit -m 'add zip file'
git push oirgin master
After executing the build, the zip file my.zip stores in the VSTS git repo.
I finally published the outcome from the first build as part of the build artefact and then used in other (dependent) builds. It was nice to do.
Also, found it equivalent to having it on NuGet. Plan to move to Nuget later.

Visual Studio Team Services Build - Git Repository

I am leveraging Visual Studio Team Services Build Vnext to build ASP.NET application present in my Microsoft GIT Repository.
The Microsoft GIT repository is created under an Agile Team Project of the VSTS instance.
The VSTS build is getting executed successfully without any issues.
But I have a query with respect to the cloning activity of the GIT Repository that gets executed on the VSTS Build Agent.
During the build, the VSTS build Agent is cloning the entire master branch of the GIT repository instead of downloading the required ASP.NET application folder.
Is there a way to download the specific application folder on to the build agent instead of the entire branch.
we have this option for the onpremise TFS build having TFS as the Source control.
As far as I know there is no way to pull only a specific folder on a git repository unlike tfsvc. This is why you don't have such an option for the build tasks.

build wso2 apim 1.10.0 from source

So far I installed deployment version of wso2 AM. Now I would like to build it from source and try running it instead of the binaries I downloaded from the site.
Based on WSO2 documentation, I understand the steps are:
1) Download the carbon kernel source:
git clone -b 4.4.x https://github.com/wso2/carbon-kernel.git
2) Download the APIM source:
git clone https://github.com/wso2/product-apim
3) Build APIM from source
cd <SOURCE-DIR>\product-apim
mvn clean install
Are these steps sufficient, or am I missing something?
Should I build carbon-kernel in addition to building apim-manager?
On previous stackoverflow question, I read that carbon-kernel is not really necessary, and instead i should download and build carbon-apimgmt. Is this correct?
After I build the sources, how do I "package" all the compiled binaries along with all other necessary artifacts, in order to form an equivalent package to the wso2am-1.10.0.zip which I download from the site? Or is there another way to install and run the built code?
Github projects related to API manger can be found in following locations
apimgt component repo:
https://github.com/wso2/carbon-apimgt
This repository contains org.wso2.carbon.apimgt component related source code.
product repo:
https://github.com/wso2/product-apim
This repository contains all the resources needed to build the product package and intergration tests for the product.
master branch of these repositories are used for current development. (if you open parent pom.xml file you would find SNAPSHOT versions). If you build the default branches you would build the current development version of the api manager. (at this time, 1.10.1-SNAPSHOT). To build already released product you need to build released tag.
Steps to Build API manager 1.10.0
clone product:
git clone https://github.com/wso2/product-apim
Checkout release tag v1.10.0:
git checkout v1.10.0
Build the product:
mvn clean install (or mvn clean install -Dmaven.test.skip=true to skip integration tests)
get the product from
product-apim\modules\distribution\product\target
You do not have to build the 'carbon-apimgt' repository because the component build using that is already released and can be found in the nexus repo.
If you want to build the component (say need to provide a fix for a bug) build the 'v5.0.3' tag from the 'carbon-apimgt' repo.
git clone https://github.com/wso2/product-apim
git checkout v5.0.3
I'm posting the steps I did:
git clone https://github.com/wso2/carbon-appmgt
git clone https://github.com/wso2/product-apim
cd <SRC>/carbon-appmgt
mvn clean install
cd <SRC>/product-apim
mvn clean install
The ZIP file was found in
<SRC>\product-apim\modules\distribution\product\target
It is similar to the ZIP file that you download from the site.

Where is my cloned MITK?

I'm going through this tutorial. I have performed the following command to clone MITK:
git clone http://git.mitk.org/MITK.git
I'm using a Windows machine. Where can I find the cloned directory on my machine?
Thanks.
Well, it depends on where you cloned it. On Windows git console opens in C:\Users\username\ folder by default. So, look in C:\Users\username\MITK.
Type pwd in git console to see where you are.