Cloning Repository
- You have a GitHub repository in the cloud. Every team member should clone this repository.
- That means they should take a copy of this repository and put it on their machine.
- Locally, user will work with that repository. And when they're ready to share their changes, they will push their commits to this central repository.
Clone
- Go to github.com > repository
- Click code > clone > copy
git clone url
git clone url ProjectName (to rename the project)
- Git is going to create a directory by the same name, the same name as our repository.
- git clone our entire repository. So all the commits in the central repository also exist here on my machine.
- You have head pointing to master. and we have these two pointers in
origin/master
and origin/head
- When we clone a repository, git names the source repository
origin
. So origin is a reference to that repository.
origin/master
tells us where is the master branch in that repository, because now we have multiple repositories, and the history in each repository can evolve independently.
origin/master
is called a remote tracking branch.
origin/head
tells us where's the head pointer in our origin repository.
Git remote
git remote
- shows the list of remote repositories. A remote repository is a repository that is not on our machine more accurately, it's not in the current directory. So currently, we have only a single remote repository, that is our origin repository.