Table of content

Forking and Cloning with Git

In this project, we are going to learn how to join an existing project with Github through Forking and cloning a remote repository.

Forking:

Forking is nothing but creating a copy of a repository, it allows you to make changes or experiment with the changes without affecting the original project.

Forking helps us to use the others project as a starting point of your own projects. Forking acts as a short bridge between the original repository and your personal copy.

Cloning:

Cloning is the process of creating a local repository by using the command line. cloning a repository means downloading a copy of source code from source control, where Git is a source control here.

Now let's Join an existing project with Github:

  • To fork a repository you should be a member of any organization and your repository should not be empty so here for demo purpose am using scm-ninja/start-web repository.
  • Go to an URL https://bitly.com/git-start-web
    bitly-start-web
  • You are directed to the scm-ninja/starter-web page.so the first thing you need to do is, sign in to your GitHub account and then you came back to the repository just before we were on.
    scm-ninja-starter-web-page
  • Click on the Fork button on right upside corner.
  • Now it will ask you for user id and password so go ahead and give all the details. hence,
    it will create a copy of the repository into our personal system/place.
  • Notice that the repository reflects your user id and your repository name and underneath that, you will see that, you are forked from the scm-ninja/starter-web, where scm-ninja is the organization name here and also the original repository we came from, that is starter-web.
    reflects-userid-repository-name
  • So now we have a copy of our repository to work on. Next, we need to clone this repository to our local system.
  • Click on the copy or download and copy the URL.
    copy-starter-web-url
  • Open Gitbash now, and give pwd and check your home directory so here am doing everything in projects folder, this is a location where am going to clone the repository and then give the command as git clone <URL>
    clone-starter-web
  • let's give cd starter-web-1/ , once we are in this folder give ls command to see all the folders from the repository.
  • And also give ls -al , where it will display all the files and folders including files as well and you can see .git folder was created by default through cloning.
    starter-web-git
  • You can notice that .git folder, which is actually our repository and goes to that folder by using cd .git/ command and dols you will see all the folders that actually create the repository.
  • Now, go back cd ..
  • And give git status, this will explain to you everything that, it's on the master branch and the working directory is clean because we don't have any files in the working directory.
    starter-web-git-status

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions