0

I have the requirement to periodically read latest code from a git repo (BitBucket) onto my machine, then push files these into an existing TFS project. The files in BitBucket are being actively worked on, but I need add the latest version of these files into a VS project, and push them up to TFS (Cloud TFS).

As a non-Git user, i'm struggling to understand the terminology. I have found the following questions, but I don't really understand them:

Ideally I'd like to do everything though the VisualStudio 2015 IDE.

Edit

The TFS project is NOT Git based, its classic TFVC.

Community
  • 1
  • 1
Sprintstar
  • 7,938
  • 5
  • 38
  • 51
  • What don't you understand? There are step-by-step instructions being provided. Which step is causing you confusion? – Daniel Mann Feb 27 '17 at 13:56
  • The existing TFS project uses TFVC i.e. Classic TFS version control? – Giulio Vian Feb 27 '17 at 13:57
  • @GiulioVian TFS project is at https://mydomain.visualstudio.com, so I assume that's "classic TFS"? – Sprintstar Feb 27 '17 at 14:44
  • @DanielMann I don't understand how to import the code from Git via VS. – Sprintstar Feb 27 '17 at 14:45
  • @Sprintstar Git is a command line tool first and foremost. Visual Studio provides some abstraction around common use cases, but not everything. Get used to using the CLI. – Daniel Mann Feb 27 '17 at 14:46
  • @DanielMann Are you saying I can't pull a git repo down to my hard drive using VS? – Sprintstar Feb 27 '17 at 14:52
  • 2
    @Sprintstar We're terminology problems right now that make it hard to figure out what you're actually trying to do. A Team Project can contain both TFVC repositories and Git repositories. There's no such thing as "classic" TFS. There's TFS (on-prem) and Visual Studio Team Services (cloud, represented by a domain that contains `visualstudio.com`). Totally separate from that, there are TFVC repositories and Git repositories. Then, totally separate from that, there's Visual Studio. – Daniel Mann Feb 27 '17 at 15:05
  • @DanielMann Ok, so, basically I need to add files that are in BitBucket to a Visual Studio Team Services project. – Sprintstar Feb 28 '17 at 08:17

1 Answers1

1

It's very easy to achieve. You must have a local git repo corresponding to a remote repo holding by BitBucket on your machine.

Then you just need to add a new remote client(TFS holding) for your local git repo. Such as using git remote add command. You should be able to push your local code to a remote repo holding by TFS server.

What you need to do is pull down the latest code from the remote BitBucket repo to your local git repo. Then push your local git repo to remote TFS repo. Follow the tutorial of second link in your question.

If you are a totally new user to GIT, suggest you take several hours to go through this link Learn Git. Moreover, Git command is very powerful. No matter what, you always need it. Combine VisualStudio 2015 IDE and Git command when you are working with GIT.


Update

  1. In VS- Team Explorer find your local repo, if there are not then add it.

    enter image description here

  2. Double click to open your local repo -settings - repository settings- add remote url

    enter image description here

Then you will be able to push your local repo to remote repo holding by TFS or VSTS.


Update 2

If you TFS project is not GIT based. You could use git-tfs is a two-way bridge between TFS (Team Foundation Server) and Git. Or more easier way- create a git repo in your TFVC project. You could hold TFVC and Git repositories in the same team project if you want to.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • Could you detail the step by step instructions to do this? So do I use 'Clone' within VS? If I try that I get "The folder D:\blah\blah\blah already exists and is not empty. Choose a new folder or an empty folder for the cloned repository." – Sprintstar Feb 28 '17 at 08:28
  • @Sprintstar No, clone are used for cloning remote repo to local folder. However you already have a local repo. You need to "binding" it to a remote repo in TFS. Please see my update screenshot show how to do this in VS. – PatrickLu-MSFT Feb 28 '17 at 09:16
  • You describe my "remote" as its Git based, but its not, its just TFS. Does it matter? – Sprintstar Feb 28 '17 at 10:13
  • @Sprintstar TFS can hold both TFVC and GIT remote repo since TFS2013. You need to use git repo. Not sure which one are you actually using . You could judge it by the url if you are working on a remote Git it should include `_git`. – PatrickLu-MSFT Feb 28 '17 at 10:42
  • No, the TFS project is NOT Git based, its just TFVC. – Sprintstar Feb 28 '17 at 16:04
  • @Sprintstar If so, you could use [git-tfs](https://github.com/git-tfs/git-tfs) which is a **two-way bridge** between TFS (Team Foundation Server) and Git. Or more easier way- **create a git repo** in your TFVC project. You could hold [TFVC and Git repositories in the same team project](https://blogs.msdn.microsoft.com/visualstudioalm/2015/12/03/tfvc-and-git-repositories-in-the-same-team-project/) if you want to. – PatrickLu-MSFT Mar 01 '17 at 10:10