I was able to find a way on GitHub Website to rename a single file and did so with success.
I was also able to find a way to rename a whole repository and did that with success.
Does anyone know how to do this to a single directory without using command line? For reference, I am trying to change a directory named InterviewTesting (that contains src files, etc) to something else. I tried doing it the single file way.
But this didn't allow me to change the name of the directory (InterviewTesting), only the actual file name.
I had an issue with github missing out on some case sensitive changes to folders. I needed to keep migration history so an example of how I changed "basicApp" folder in github to "basicapp"
$ git ls-files
$ git mv basicApp basicapp_temp
$ git add .
$ git commit -am "temporary change"
$ git push origin master
$ git mv basicapp_temp basicapp
$ git add .
$ git commit -am "change to desired name"
$ git push origin master
PS: git ls-files
will show you how github sees your folder name
If you have GitHub Desktop, change the names of the directories on your computer and then push the update from your desktop to your github account and it changes them there. :)
Hope it helps!
You can! Just press edit as per @committedandroider's original post and then hit backspace with your cursor at the start of the filename. It will let you then edit the folder. When done hit forward slash to then edit the filename again.
There is no way to do this in the GitHub web application. I believe to only way to do this is in the command line using git mv <old name> <new name>
or by using a Git client(like SourceTree).
Go into your directory and click on 'Settings' next to the little cog. There is a field to rename your directory.
You could use a workflow for this.
# ./.github/workflows/rename.yaml
name: Rename Directory
on:
push:
jobs:
rename:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git mv old_name new_name
- uses: EndBug/[email protected]
Then just delete the workflow file, which you can do in the UI
Go to that directory/folder and then click on the setting. In the section of "Repository name" simply rename it.
I changed the 'Untitlted Folder' name by going upward one directory where the untitled folder and other docs are listed.
Tick the little white box in front of the 'Untitled Folder', a 'rename' button will show up at the top. Then click and change the folder name into whatever kinky name you want.
See the 'Rename' button?
As a newer user to git, I took the following approach. From the command line, I was able to rename a folder by creating a new folder, copying the files to it, adding and commiting locally and pushing. These are my steps:
$mkdir newfolder
$cp oldfolder/* newfolder
$git add newfolder
$git commit -m 'start rename'
$git push #New Folder appears on Github
$git rm -r oldfolder
$git commit -m 'rename complete'
$git push #Old Folder disappears on Github
Probably a better way, but it worked for me.
Source: Stackoverflow.com