Delete a Clone Git and Clone Again

When a user clones a Git repository from Github using the command git clone <url>, they go a re-create of the remote repo on their local computer and then that they can piece of work on it on their current working directory where the repo got cloned without directly making changes on the remote repository.

If you desire to delete a local Github Repository that was cloned from to local estimator without touching or making any changes to the Remote GitHub repository then follow the commands below:

Step 1: Go into your project file

cd <project_name>

rm -rf <repository_folder>.git

With the deletion of the '.git' file, this will delete the .git file that contains a log of the commit history, its information, and also remote repository address from the working directory. Nosotros tin call up of this deletion as when we do git init to initialize the current working directory as Git directory, with the above command we are just reverting it back to not being a Git directory.

Then what about the files and folder in the present working directory?

This has to exist deleted using the post-obit set of command:

Step two: (Optional if you want to initialize working directory to another GitHub Repository Run across Additional steps below):-

Become to the directory where the project is present (Annotation: Don't get inside the project file).

rm -rf <folder_name>

What are rm and rf commands?

  • In Linux, the user can delete/remove directories using rmdir or rm, in the above case we have made use of rm which is used to remove not-empty directories, unlike rmdir which is used to remove empty directories.
  • This command is used to remove non-empty directories and all the files in the directory without being prompted if a directory or a file in the electric current working directory is write-protected (this case is very common when working on forked repository from GitHub) and the user is prompted to provide Y (for yes) to ostend the deletion of the write-protected file. Now using -rf with rm is effective equally it can skip part of the user beingness prompted every time.

Additional Steps:

Suppose you want to initialize (git init) a new Github repository, so add it to a new remote repository and so start adding and committing to the files being added from the electric current working directory.

  1. Make sure that the current working directory is the directory that needs to exist pushed to the open-source platform (GitHub).
  2. git init
  3. git remote add origin https://github.com/user/repo.git
  4. git push -u origin main

Deleting the Repository from GitHub Website

Footstep i: Navigate to your project

https://github.com/your-github-username/Project-Proper name

Footstep 2: Get to the settings choice on the elevation right corner like the image above, and navigate down to the danger zone

Footstep 3: Go and click on the delete this repository button and after which you will exist prompted to brand sure yous are deleting and all these action will permanently affect the repository, in the box type your-username/project-name (replace it with yours).

You lot may too be prompted to type in the GitHub countersign.

Following these steps will brand sure you have completely deleted the repository from the local PC also as the GitHub site.

Here nosotros are going to delete a item file from our github using Github. This feature can be useful when we have by ,error added few files in our projection just we no longer need that.

Deleting the File from GitHub Website

Step 1: Navigate to your project

https://github.com/your-github-username/Project-Name

Step ii : Browse to the file in your repository that you want to delete.

At the top of the file, click on the Delete Icon.

Step iii: At the bottom of the page, type a short, meaningful commit message that describes the change yous made to the file

And then it will show a warning similar this that the File successfully deleted.

moorerabliver.blogspot.com

Source: https://www.geeksforgeeks.org/deleting-a-local-github-repository/

Related Posts

0 Response to "Delete a Clone Git and Clone Again"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel