SearchForKnowledge
SearchForKnowledge

Reputation: 3751

How to use Git to allow multi user edit of files from multiple machines connected to a single server

I was using TFS Source Control to store my code in a centralized repository but the only drawback was, I wasn't able to just download a single file and make changes and check it back in. Also, each PC is required to have a VS license to use Source Control.

I was researching on other options and came across Git and I installed in in my PC. I have created a repository and still learning the ins and outs. I do have some question which I hope this community can help me answer.

I have a server where I would like to check in all repositories and allow multiple PCs to download the file to their local PC and make changes and commit back to the server.

Here is a scenario:

enter image description here

So if I create a new files/project in my PC (PC 1), I would like to commit to the server. Once that is done, PC 2 would like to download that to the local machine and make changes and commit it back to the server. PC 2 would also like to have the ability to pick and choose the file it wants to download locally to make edit.

Is it possible with Git or is there a better alternate to TFS Source Control.

I would like the following function:

Thanks for the help.

Upvotes: 0

Views: 974

Answers (2)

gpullen
gpullen

Reputation: 1133

Hope this makes it clearer.. Couldn't fit all this in comments!!

What are remotes?

Remotes are URLs in a Git repository to other remote repositories that are hosted on the Internet, locally or on the network.

Such remotes can be used to synchronize the changes of several Git repositories. A local Git repository can be connected to multiple remote repositories and you can synchronize your local repository with them via Git operations.

Note - Think of remotes as shorter bookmarks for repositories. You can always connect to a remote repository if you know its URL and if you have access to it. Without remotes the user would have to type the URL for each and every command which communicates with another repository.

It is possible that users connect their individual repositories directly, but a typically Git workflow involves one or more remote repositories which are used to synchronize the individual repository. Typically the remote repository which is used for synchronization is located on a server which is always available.

Remote Git repositories Tip A remote repository can also be hosted in the local file system.

Bare repositories

A remote repository on a server typically does not require a working tree. A Git repository without a working tree is called a bare repository. You can create such a repository with the --bare option.

create a bare repository

git init --bare By convention the name of a bare repository should end with the .git extension.

To create a bare Git repository in the Internet you would, for example, connect to your server via the SSH protocol or you use some Git hosting platform, e.g., GitHub.com.

Upvotes: 3

Muhammad Soliman
Muhammad Soliman

Reputation: 23756

You have to understand that (Centralized version control) is somewhat different than TFS .. Below are hints that might help you to answer your question

  • create a new repository inside your local machine (which having repository too), this is mainly could be used for any directory whether the project is new or currently existing in you machine

    git init

  • checkin is done first locally using "commit" which is pushing/checking in your changes to your local repository (not the central server)

    git commit -m "comment"

  • pushing the changes (multiple commits) from your local repository to server's repository

    git push origin master

  • Now after the "push", other machines (your colleagues) could get these changes using pull command.

  • There is graphical tools to deal with git whether in linux or windows based platforms, discover them out here.

HINT: there is extension for visual studio that could be used too if you are still going to use it.

Upvotes: 1

Related Questions