get latest external file automaticly with project - version-control

I was create Project folder and Some sub folder that have solution under sub folders.
user A use solution A under sub folder A, user B use solution B under sub folder B (means that he map only folder b and work on it) and etc.
we have some common files that use on the all project (A,B,...) we can put them under the one folder for examople "Common" under the Project folder.
user A want to work with his project he get folder A but he need to Common folder files too. what to do?
like ewise user B want changes this file. and use to his project (B).
I want have automatic way to get external file with solution simultaneously.

To get the common files under the Common folder together with solution, you can consider using batch script which contains two tf get commands:
tf.exe get /recursive $/SolutionA
tf.exe get /recursive $/Common
When running this batch script, both SolutionA and Common folder are downloaded.

Related

How to mirror/synchronize a local workspace folder with the server folder?

I have a folder that regularly gets updated. This folder is a part of a TFS workspace. I need to commit all those changes to the workspace once they occur (add what isn't there, delete what was removed and update what was changed).
Currently, I have a script that runs tf vc folderdiff command on the folder and its server counterpart, parses out the output to get three lists - files that need to be added, deleted and updated. It then manually adds, deletes and updates those files by invoking tf add/delete/checkout on batches of files (trying to add/delete/checkout in one go can cause an error if there are too many files in the list).
There has to be some better way. Is there some kind of tf command where I can tell it, look at this local folder, look at the server folder that is mapped to it and make the server folder look exactly the same? Bonus points if I can specify some kind of filter to exclude certain paths or file names/extensions.
Apparently there exists a tf reconcile command. You can learn more about the syntax here: https://learn.microsoft.com/en-us/azure/devops/repos/tfvc/reconcile-command
Off the top of my head, the following command should do what I want:
tf reconcile [path to folder] /promote /adds /deletes /recursive /noprompt
There is also /exclude that can be used to filter unwanted files, so I get the bonus points too.
Of course I had to stumble upon it right after asking a question...

.gitignore not ignoring a folder within a directory

It seems a straightforward one, but having researched multiple ways to do it, I can't gitignore a folder within a directory.
I have a root directory which contains all of my code in it. Because it has some back-end NodeJS stuff in it, it has a 'node_modules' folder which contains hundreds of files. As a result, when I try to upload the entire parent folder, GitHub says there's too many files to upload and tells me to reduce the number I'm uploading.
The crucial part is though, the folder has to be uploaded as a whole, as it itself is within a GitHub repository with other files with different folders in.
That means when I go onto my repository, I need this folder's files to display within the folder, and not separately within the repository. I need all of the files to be within this folder, within the parent repository, excluding the node_modules folder.
For example ->
Parent repository -> Child Directory (what I'm uploading) -> Individual files
I've tried to add the node_modules folder to my gitignore through the following methods:
Adding: node_modules/ to my gitignore file
Writing: echo node_modules >> .gitignore through my terminal
Adding a separate gitignore file within my node_modules file with a * in it
None of them have worked and I can't find any other solutions. For reference I'm using a Mac.
Does anyone have any idea what I'm doing wrong, or how it'd be best to do it?
By default, you do not need to include the node_modules folder in your repositories because the package.json file contains all of your project's dependency information. This means that anyone who clones your repository can run npm install and have the entire node_modules folder without problems.
To solve this you can create your own .gitignore file, creating a new file at the root of your project and renaming it to .gitignore (writing exactly that way). Then you can open it with any text editor and add */node_modules to one of the lines.
This will likely solve your problem.

Excluding files/folders from VSTS publish

We are using the new VSO/VSTS style build within TFS on premise, 2015 Update 1 as of yesterday.
During the publish build artifacts stage we want to copy all the files/folders from a root bar 2 sub folders.
ie:
$\somefilestopublish1\...
$\somefilestopublish2\...
$\somefilestoexclude1\...
$\somefilestoexclude2\...
Currently I have **\* as the contents argument which obviously will publish everything. I have tried appending ;-:<exclude_pattern> as suggested by a Google search but that just stopped all output and resulted in an empty folder.
Is there a way to use the minimatch expression to exclude folders or will I need to swap to explicitly selecting the folders to publish instead.
Minimatch use "!" to exclude the given pattern. You could specify it with following format:
!(somefilestoexclude1|somefilestoexclude2)
Following is the example:
With !(bin|obj), "bin" folder and "obj" folder under "WindowsFormsApplication1" folder are not copied to artifact.
!/$tf/** works for me. I've opted to shorten that to !/$*/**
http://www.globtester.com/ helped. The $ symbol doesn't have to be escaped despite conflicting guidance on msdn: https://msdn.microsoft.com/en-us/library/bb383819.aspx.
Suppose you want to collect all the *.nupkg files in your solution (for instance the ones you create during build) and copy them to another folder, but you want to exclude the ones you get through the package restore, you need to specify the following:
**\*.nupkg
!packages\**
It's important to specify them in this order. Placing the exclusion on the packages folder on top, will result in the Copy task copying all the *.nupkg files.
This worked for me for folder try this !**\Uploads***
For file **!(Web.config)
Above example is for excluding a folder and file available in same folder path.
On TFS 2017 Update 1 if you are using the Copy Files task and you want to copy all files from the $(Build.SourcesDirectory) but exclude the $tf folder what I found to work was the following.
In the Contents text box enter the following two lines.
**\*
!$tf\**
This post on social.msdn.microsoft.com is what helped me figure this out.

How can I add a directory tree to my github repo?

I've been working on a project that's fairly far a long now and I decided it's time to use some sort of version control etc. I decided to go with github. Before I get in too deep let me state explicitly that I am new to github.
My project resides in a directory that contains myriad subdirectories and files of all different kinds. I'd like to take my project directory as is (structure and all) and put it in my github repo.
I followed the tutorials on github's webpage, created the repo, and manually added some files. Obviously I don't want to manually add every file (there are several hundred). I'd like to know how I can add the root directory or for that matter any parent directory and all files/folders in said said directory. In other words I'm looking for a recursive add.
I read on this SO page (How to create folder in github repository?) that you can just use
git add directory/
That works fine for me when I'm dealing with the lowest level directory, but when I try the same command on a directory with subdirectories my terminal just sits there and I have to ctrl-c. I can't tell if it's just taking a long time (as I mentioned there are lots of files) or if this is just the wrong way to add a directory with subdirectories.
Apologies in advance if this is a super ignorant question -- I have looked at a lot of blogs/posts/etc and I cannot find a solution that seems to work.
Use the Current Working Directory
Assuming you're on Linux or OS X, from the command line you would do the following:
git add .
from the root of your repository tree. That will add all non-ignored files, including non-empty directories, into the repository.
From the root directory (the one with all the subdirectories), use git add -A.
If you have a ton of subdirectories and files, it may take a long while, so just let it sit there until it's done.

Check out files with TortoiseSVN from multiple repositories

I am trying to check out multiple items from two repositories. One checkout goes to the root folder, and another would be checked out to a subdirectory.
Structure:
root
source
invoice.p
compiled
invoice.r
forms
templates
invoice01.xml
invoice01.png
I right-click on the root folder and click "SVN Checkout...". I'm checking out the invoice.p and invoice.r files (specifically) with the same structure from the first repository. The checkout type defaults to "Custom Depths" and everything goes fine. The source and compiled folders show up with the check icon. Then I'm trying to get the invoice files from the second repository, but I am not sure how to check them out. I can right-click on the forms folder in my checkout directory, but no matter how I set it up, it always pulls down the wrong structure, for example:
forms
templates
forms
templates
invoice01.xml
invoice01.png
If I try to select the root folder to check out from the second repository, the original source and compiled folders get overwritten/deleted since they don't exist in the second repo. I can choose invoice01.xml and invoice01.png to go to the templates folder one at a time, but for some projects I may have 30-40 items I'd need to individually check out. Is there an easier way to check out multiple items but to ignore the folder structure?
You can't nest working copies (which is what you're attempting to do here). The lone exception is if your inner working copy is created via an svn:external pointing elsewhere.
If you create an svn:external in the repository directory root is pointing at, call it forms and point it at the URL for the forms repository, you can do what you're attempting. Otherwise, it's not possible.
To answer your query, in case the files are in the same root location like:
-forms
-templates
- invoice01.xml
- invoice01.png
They shall be checked out with the Tortoise SVN URL Repository paths separated by * (asterisk symbol) like:
forms/templates/invoice01.xml*forms/templates/invoice01.png
Thus, in one go only, these files inside the root folder would be checked out even if the actual folder of templates had other files.
In case of a different root location, different folders have to be created and checked out. No other way!