• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

How to remove file and directory from Git repo

December 29, 2013 by Sharad Chhetri Leave a Comment

In this post I am sharing the command to remove files and folder from git repo.The command will remove files from the working tree and from the index.
Note: Before removing any files and directory it is always a good practice to keep the backup of the data.Hence suggesting to first take the backup of your data.

Follow the given below steps to remove file and directory from git repo

We assume you have already cloned the repository in your system from git server.Here for eg. we are giving the repository name as test-repo

Step 1: Change to Working repository in your system

cd test-repo

Step 2: Here in this step, we will remove both file and directory

To remove the file from working tree and index,run the below command

git rm file-name

To remove directory,from working tree and index,run the below command

git rm -r dir-name

Note: If you want to remove all files and directory at a time,then change to directory and run below command. Here in below given command period(.) means from current location.

git rm -r .

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
  2. How to write description of git repo
  3. How to setup Jenkins Credentials for Git repo access
  4. NOTICE: nagios.cmd file not found. Please specify the location of this file in your /etc/vshell.conf file
  5. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
  6. SCP file and directory in linux and Unix like operating system
  7. hash:/etc/postfix/virtual is unavailable. open database /etc/postfix/virtual.db: No such file or directory
  8. XAMPP : Mysql # 2002 – No such file or directory
  9. jemalloc/jemalloc.h: No such file or directory – Redis
  10. /usr/bin/env: node: No such file or directory

Filed Under: Git Server Tagged With: git

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Commands

How to show line numbers with less command in Linux

semanage command not found in CentOS 6 and RHEL 6

vi : Edit file without opening it

How to list users above or below particular user id

Allow only members of Wheel group to use su command on RHEL/CentOS

How to test rpm package before installation

Jpeg Image Optimization / Compress on Linux

Explore 70+ Articles On Linux Commands

Always Useful Tips And Tricks

AttributeError: ‘WSGIRequest’ object has no attribute ‘session’ Django python web framework

Nagios HTTP WARNING: HTTP/1.1 403 Forbidden

GNU Screen

error could not configure a c compiler Linux

30 useful Linux terminal keyboard shortcuts

Forward all incoming emails to other SMTP server or gateway

Forgot root password ,Reset it in Run level 1

Explore 90+ Article On "Linux Tips And Tricks"

You Might Like These Articles!

Internal External Command

What is Linux/Unix Internal And External Command

Linux basic command

Linux Basic Commands With Examples For Every Beginner

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission but Schools and Colleges can do in their Private Network
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy