How to Rename & Move Files in Git (Using `git mv` Correctly)

Don’t break your Git history by renaming files manually! 🚀 In this tutorial, **Beshilo Coding Academy** explains how to use the `git mv` command to rename and move files while keeping your version control history intact.

We walk through real-world examples, like changing a `register.js` file to `login.js`, and how to handle file extensions (like `.py` to `.css`) directly from the terminal. This is a crucial skill for maintaining a clean and professional repository.

**What You’ll Master:**
✅ **The `git mv` Command:** Why you should use it instead of your computer’s standard rename.
✅ **File Renaming:** Step-by-step guide to changing file names without losing track of changes.
✅ **Directory Management:** Moving files between folders while staying under Git control.
✅ **Verification:** Using `ls` to confirm name changes and checking the status of your “tracked” files.
✅ **Pushing Updates:** Committing and pushing your renamed files to GitHub.

—–

### **⏱️ CHAPTERS (Exact Timestamps)**

00:00 – Why Manual Renaming Breaks Git Tracking
00:15 – Committing Existing Files Before Renaming
00:30 – Using the `git mv` Command to Rename Files
00:50 – Verifying Changes: `ls` vs. Original File Names
01:03 – Practical Example: Renaming Extensions (.py to .css)
01:25 – Moving Files into Folders via Terminal
01:52 – Finalizing Changes: Staging, Committing & Pushing
02:18 – Troubleshooting: Ensuring Your Files are Properly Tracked
02:35 – Summary: Best Practices for File Management in Git

—–

### **Resources & Links**

🔗 Git Documentation (git mv): https://git-scm.com/docs/git-mv
🔗 Download Git Bash: https://git-scm.com/downloads

**Master the Rest of the Workflow:**
📺 [Daily Git Workflow: How to Update Files & Push Changes](https://studio.youtube.com/video/Yn6mb0TK4_w)
📺 [Git & GitHub Full Course for Beginners | Zero to Hero](https://studio.youtube.com/video/T_Js1IIOhUs)

—–

### **About Beshilo Coding Academy**

We help you master the “hidden” commands of Git that separate beginners from pros. By learning how to manage your project structure correctly, you’re building better software. Subscribe for more deep dives into developer tools!

#GitTutorial #CodingForBeginners #GitMv #ProgrammingTutorial #WebDevelopment #SoftwareEngineering #BeshiloCodingAcademy #VersionControl #TerminalCommands #GitHubTips

Leave a Comment

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

Scroll to Top