Can I not create a local repository in GIT?

2014-03-29 6:39 am
My friend has created a GIT repository in bitbucket and he would like me to collaborate with him to work on the project. I have no experience with GIT before so I have a few questions.

(I have installed GIT on my ubuntu machine and I also have created an account in bitbucket.)

I have heard that GIT is a distributed version control system, should I create a local repository from the remote repository and then create a working copy from the local repository? By doing this, any modifications will be first updated to the local repository and then later will be updated to the remote repository.

But since the remote repository is always available and I won't work offline, can I not create the local repository and only have working copy on my machine?

回答 (1)

2014-03-29 8:04 am
✔ 最佳答案
I think you've got some terms mixed up. In Git, your "working copy" is located in your local repository.

Basically, it works like this:

Assuming you have access to your friend's remote Bitbucket repository, you can clone that repository. Doing so will automatically create a local repository on your computer. You will then be working in this local repository.

If you modify, add, or otherwise change any files in the local repository, Git will detect this. Once you are ready to commit your changes, you can do so, and that will update the commit log in your local repository. You can then "push" the new commits from your local repository to the remote repository, so that your friend can pull those changes and update his own local repository.

So, in other words, your local repo IS your working copy. Any changes you make to the files located in your local repo can be committed to your local repo, and can then later be pushed to the remote repo.


收錄日期: 2021-04-17 02:33:58
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20140328223956AAxOs3m

檢視 Wayback Machine 備份