Sarathlal N

Change the directory name of Git repository

I have some projects as a git repo. Some times, I need to change the directory names of my project. Normally directory name changes are not considered as a chnage in git. Also I have some CI / CD code related with repo names.

I always use remote repos. Now consider that all our changes are already committed & pushed to the remote branch. If so, the workflow is given below.

Step 1. Clone the repo in to a different destination

git clone <repo-url> <new-directory-name>

Step 2. Create a new repo in a remote server with a new name. Note down the new repo URL.

Step 3. Navigate to cloned repo

cd <new-directory-name>

Step 4. Set new origin URL

git remote set-url origin <new-repo-url>

Step 5. If you have to do any changes, do the changes, commit & push. Else just push to the remote using the push command.

Looking for a skilled WordPress/WooCommerce developer? I'm currently available for freelance, contract, or full-time remote opportunities! Let's create something amazing together. Send me a quick message, and I'll respond within 24 hours!

Recent Posts

  1. Automating Code Linting with GitHub Actions for WordPress Plugins
  2. Comprehensive Guide to Linting PHP, JavaScript, and CSS in WordPress Plugins Using Composer
  3. The Ultimate Guide to Indexing in Database Design
  4. Understanding 'update_meta_cache' in WordPress - When to Use It, When Not to, and Its Impact on Database Queries
  5. A Guide to Configuring JavaScript and SCSS Paths in WordPress Plugins with @wordpress/scripts

Your Questions / Comments

If you found this article interesting, found errors, or just want to discuss about it, please get in touch.