|
Renaming the file is very important when we are working on a project. Git Rename is used to rename a file in the working directory. Suppose we are working in a team and any fellow developer created the file and we want to rename it using Git or Github so this command help us to do so. We may change the name of the file even though we created the file due to some reason. To rename any file or folder, use git mv command which takes two arguments. The first argument is the source and the second is the destination. We can easily rename any file using the git command and the new name will be assigned to that file. We can rename the file using GitHub or the command line. We’ll discuss both approaches.
Way 1: Rename using GitHubStep 1: Open GitHub. Step 2: Open the repository to rename any file in that repository. Step 3: Open the file which we want to rename. Step 4: Click the edit button and rename the file. Step 5: After renaming the file, commit the changes. Step 6: A file with the new name will be saved. Way 2: Renaming using the Command LineStep 1: Open Git Bash. Step 2: Open the repository. Step 3: Rename the file using the command: git mv old_filename new_filename Step 4: Use the “git status” command to check the changes. Step 5: Commit the renamed file. git commit -m "Renamed_file" Step 6: Push the changes using “git push origin branch_name” It is as shown in below pictorial aid. |
Reffered: https://www.geeksforgeeks.org
Git |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 10 |