Collaborate in a Git team project (pull, push)
When you collaborate on Team Foundation Server (TFS), your team uses version control integrated with other powerful capabilities such as planning and tracking projects and automated CI and scheduled builds. You can create a Git team project on either an on-premises server that you set up yourself, or on one that we maintain for you on Visual Studio Online. Or, if you prefer, you can collaborate in remote Git repositories hosted by third-party services such as CodePlex, GitHub, or Bitbucket.
Fetch commits from your team
Pull commits from your team
Push to contribute your changes with the team
Push to an alternate remote
Conduct a Git pull request (for an on-premises team project you must first install Team Foundation Server Update 4)
Browse the team project
Subscribe to alerts
Work in a team project with multiple repositories
Q & A
Take next steps
Fetch commits from your team
If you want to preview the changes from your team before you integrate them into your work, from the commits page (Keyboard: Ctrl + 0, O), fetch commits from your team project.
After you fetch a commit, to get more information, open its context menu and choose View Commit Details.
Note
You must also fetch before you can get a copy of a branch that someone on your team has published.
Pull changes from your team
When you are ready to integrate changes from your team into your local repository, in Team Explorer, go to the commits page (Keyboard: Ctrl + 0, O). Pull any commits that might have been pushed by your team.
If conflicts occur…
you must resolve them before you can proceed.
Push to contribute your changes with the team
When you are ready to contribute your committed changes to the team’s remote Git repository, push them from the commits page (Keyboard: Ctrl + 0, O).
Note
If your team has pushed commits to the branch since you last cloned or pushed, then you must first pull all the changes from the remote repository before you can push your changes into it.
Push to an alternate remote repository
In some cases, you might want to push to an alternate remote repository. (You must have installed Visual Studio 2013 Update 2 or a subsequent version to use this feature.)
For example, you are developing a web site in a Git team project. You want to publish the web site to Windows Azure, so you add your Windows Azure site as a remote repository. When you are ready to publish the site, you can push to it.
Note
This option is available only in Visual Studio 2013 Update 2 and appears only if your Git repository has more than one remote. To add a remote, open the Git command prompt and then use the git remote command. See also: Git-SCM: Git Basics - Working with Remotes
Browse the team project
To browse the team project, open it in your web browser (Keyboard: Ctrl + 0, A).
Explore the files
Explore the files
Before you explore the files, specify the branch or tag you want to use to filter the view.
On the Explorer page, browse the file tree and view each file. You can also see who changed what in each file.
You can also:
Get the URL to clone the repository. (You don’t need a URL to clone a repository from Visual Studio, but you might need it if you want to clone from the Command Prompt or from a third-party Git client tool.)
Download an individual file and download a folder as a .zip file
Perform an Advanced search for a specific commit based on path, user (the author of the commit), and date
Subscribe to alerts
Do you want to be notified when someone pushes code into your Git team project? Subscribe to receive email alerts. Here’s how.
Work in a team project with multiple repositories
You can add additional repositories to your Git team project. Later, you can rename or delete them as needed. One benefit of working this way is that you can re-use process template customizations, such as those you’ve made to your work item type definitions, across multiple codebases.
To manage the Git repositories in your team project, open it in your web browser (Keyboard: Ctrl + 0, A).
Create a new repository when you need one (for example, to develop a new app).
In Visual Studio, select the repository in which you want to work.
Q & A
Q: I was blocked by the system because I don’t have permission. How do I get it?
A: Permission reference for Team Foundation Server
Q: How do I work from the command prompt?
A:Work from the Git command prompt.
Q: How do I pull and push in a single step?
A: Choose the Sync button.
Q: Can I modify the structure of my local commits (for example squash multiple commits into a single commit) before I push my changes?
A:Work from the Git command prompt.
How do I view, alter, or roll back my committed changes?
A:
Q: When I tried to pull I was blocked by conflicts. How do I resolve them?
Q: Can I use My Work or code reviews with Git?
A: No.
Q: Why is Push not available?
A: One common reason Push is unavailable is if you are working in a branch that you have not yet published. Switch to the Branches page (Keyboard: Ctrl + 0, N) if you want to publish the branch.
Q: When should my team add a new repository?
This decision is subjective. Many people believe that you should keep each repository to a reasonable size. When the codebase grows to a certain point, they split it into multiple repositories. Some teams believe each app should have its own repository.
Q: Is it OK to commit binaries?
In general, you should avoid committing binaries, especially large ones. An alternative way to get binaries that your app depends on is to use NuGet.