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 source 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.
asked Aug 6, 2015 at 16:59
3
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).
Hossein
23.3k34 gold badges117 silver badges217 bronze badges
answered Aug 6, 2015 at 17:13
1
Open your github repo. Press . to open it with web vs code. Rename there. Stage and commit the changes.
This will work better than the other options, as it will do the rename for directories which contain multiple other directories i.e. directories with subdirectories within them.
answered Oct 23, 2021 at 14:23
2
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.
answered Oct 18, 2017 at 7:40
Dean_CamDoDean_CamDo
3332 silver badges3 bronze badges
2
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
answered Apr 26, 2018 at 20:42
BenabokiBenaboki
1511 silver badge3 bronze badges
2
git mv <oldname> <newname>
git add <newname>
git commit -m "Renaming folder"
git push -u origin main
answered Jun 6, 2021 at 5:13
AhmadAhmad
8,2799 gold badges71 silver badges124 bronze badges
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!
answered May 29, 2018 at 3:59
NicaNica
413 bronze badges
3
Just edit a file inside the folder, click on file name and press backspace continuously. That will move to the cursor to the folder name and you can edit it.
It can cause problems with hyperlinks.
answered Mar 3, 2022 at 6:10
1
If you want to try it with the Github web:
(and don’t want to move individual files manually)
-
Download the ‘zip’ for a directory. (Repeat for all directories/folders)
-
Unzip all the directories/folders on your pc. (don’t touch the internal contents of these folders)
-
Rename these folders on your pc, such that, you precede the name of the folder name with ‘1. or 2. or 3. and so on’ (in order that you want them to appear… eg: if u want some folder to appear first, change its name from ‘xyz’ to ‘1. xyz’)
-
Upload all these directories back on Github Web.
By doing this, all the contents of your directories/folders will remain intact and in the same order as they were… just the Directories/Folders themselves will be ordered as per the number you used while naming it in Step 3.
I found this easier and quicker than moving all individual files from one directory to other.
Example — (how it would appear on Github Web)
Before : (alphabetically ordered)
abc
jkl
xyz
After :
- xyz
- jkl
- abc
answered Jan 20, 2022 at 21:26
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/add-and-commit@v5.1.0
Then just delete the workflow file, which you can do in the UI
answered Oct 11, 2020 at 8:02
MudlabsMudlabs
5515 silver badges15 bronze badges
You can do the following:
- Go to any file from the repository.
- Click the drop-down menu from the top-right of the file window.
- Click on
Open in github.dev
Github dev location - When it switches to Gihub dev environment, you can rename the required folder from the explorer section.
answered Nov 2, 2022 at 17:58
1
For all I know, there is no way you can do this from the GitHub web interface.
Here is how I was successfully able to do it —
Step 1: Rename in your local. In your local path, give command $ git mv old-name new-name.
Now it will be renamed in your local path.
Step 2: Staging. Give command $ git add .
Step 3: Commit. Use command $ git commit -m «add your comment» https://github.com/repo-name/branch-name.git
Step 4: Push. $ git push
or
$ git push https://github.com/repo-name/branch-name.git branch-name
(Instead of everytime specifying the big URL, you can use the alias «origin» or whatever you like. But first you need to give this command in the beginning $ git remote add origin https://github.com/repo-name/branch-name.git )
answered Apr 5, 2021 at 6:20
The best way to change the folder directory in GitHub is to work with GitHub Desktop.
You can clone your repository using GitHub desktop.
The folders will normally appear as Windows folders and you can play around with them (Like Renaming, Moving, Cutting, etc).
Once done, commit and push the changes through GitHub Desktop, and it’s done.
answered Jul 3, 2021 at 23:20
Now you can «open in github.dev editor» your repository. In repo page press Ctrl k
to open command pallete and type >
to show commands. First command are Open in github.dev editor
. This will jump to MS Visual Studio Code in browser with opened this repository. Using file explorer you might rename files and folders and then commit changes.
answered May 1, 2022 at 12:07
Similar to previous answer by @AsefHossain, Github has a great extension using VS Code, simply hitting shift
and .
at the same time (on a Mac at least). This opens a new web page window with your repo in the file viewer. You can edit and commit code here. Note, that this will commit directly to your main development branch, works great.
answered May 31, 2022 at 3:02
egolinkoegolinko
213 silver badges2 bronze badges
The question seems simple but it was quite hard for me to get the answer. I wanted to rename my folder from capital letters to small so I made sure my git configuration will catch that first. For this, I ran:
git config core.ignorecase false
Then simply rename your files in the VS code and commit them. You probably still see the old folders in the github repo. So go to the folder you’re interesting in deleting and press ...
button on top right and Delete directory
answered Jan 16 at 11:38
Go into your directory and click on ‘Settings’ next to the little cog. There is a field to rename your directory.
answered Jun 1, 2019 at 15:27
1
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.
answered Nov 20, 2018 at 16:34
jouelljouell
3,1401 gold badge16 silver badges15 bronze badges
1
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?
answered Feb 17, 2016 at 3:34
4
I just made a new repository with a single folder, that contains various subfolders and files inside it. I want to change the name of the «F2F» folder. I know it is possible using command line, but wanted to ask whether there is a GUI alternative to the same(on web).
Also, I’ve checked this and this, and they don’t help.
asked Nov 25, 2018 at 12:01
Ojasvi BhargavaOjasvi Bhargava
2941 gold badge2 silver badges10 bronze badges
2
Just simply go to the reop on your web browser and change the URL to «.dev»
example: change github.com/{github username}/{reponame}
to: github.dev/{github username}/{reponame}
answered Sep 8, 2021 at 13:13
3
Go to your repo that contains the folder you want to rename.
Then, press the “.” key.
A web editor will show up. Navigate to the folder, click on it, and press enter.
answered Sep 7, 2021 at 9:08
KornLSKornLS
751 silver badge7 bronze badges
0
I’m afraid you can’t do this in the browser.
Git operates just file, never folder (they are treated as file paths). And you can rename the file to «move» into another directory, in the browser, for all the files in that folder, to «change a folder name». But it seems no batch operations in the browser.
For move a file into another path in the browser: Edit that file, then you can rename the file. In the box of renaming the file, try to input slash /
or delete at the beginning of the input box.
answered Nov 25, 2018 at 12:17
Geno ChenGeno Chen
4,6576 gold badges22 silver badges39 bronze badges
Open Git Bash.
Change the current working directory to your local repository.
Rename the file, specifying the old file name and the new name you’d like to give the file. This will stage your change for commit.
git mv old_filename new_filename
get full description with example on github
answered Nov 25, 2018 at 12:08
Atul KumarAtul Kumar
3244 silver badges8 bronze badges
2
I just made a new repository with a single folder, that contains various subfolders and files inside it. I want to change the name of the «F2F» folder. I know it is possible using command line, but wanted to ask whether there is a GUI alternative to the same(on web).
Also, I’ve checked this and this, and they don’t help.
asked Nov 25, 2018 at 12:01
Ojasvi BhargavaOjasvi Bhargava
2941 gold badge2 silver badges10 bronze badges
2
Just simply go to the reop on your web browser and change the URL to «.dev»
example: change github.com/{github username}/{reponame}
to: github.dev/{github username}/{reponame}
answered Sep 8, 2021 at 13:13
3
Go to your repo that contains the folder you want to rename.
Then, press the “.” key.
A web editor will show up. Navigate to the folder, click on it, and press enter.
answered Sep 7, 2021 at 9:08
KornLSKornLS
751 silver badge7 bronze badges
0
I’m afraid you can’t do this in the browser.
Git operates just file, never folder (they are treated as file paths). And you can rename the file to «move» into another directory, in the browser, for all the files in that folder, to «change a folder name». But it seems no batch operations in the browser.
For move a file into another path in the browser: Edit that file, then you can rename the file. In the box of renaming the file, try to input slash /
or delete at the beginning of the input box.
answered Nov 25, 2018 at 12:17
Geno ChenGeno Chen
4,6576 gold badges22 silver badges39 bronze badges
Open Git Bash.
Change the current working directory to your local repository.
Rename the file, specifying the old file name and the new name you’d like to give the file. This will stage your change for commit.
git mv old_filename new_filename
get full description with example on github
answered Nov 25, 2018 at 12:08
Atul KumarAtul Kumar
3244 silver badges8 bronze badges
2
Renaming a file on GitHub
Renaming a file also gives you the opportunity to move the file to a new location
Tips:
- If you try to rename a file in a repository that you don’t have access to, we will fork the project to your personal account and help you send a pull request to the original repository after you commit your change.
- File names created via the web interface can only contain alphanumeric characters and hyphens (
-
). To use other characters, create and commit the files locally and then push them to the repository. - Some files, such as images, require that you rename them from the command line. For more information, see «Renaming a file using the command line.»
- In your repository, browse to the file you want to rename.
- In the upper right corner of the file view, click to open the file editor.
- In the filename field, change the name of the file to the new filename you want. You can also update the contents of your file at the same time.
- At the bottom of the page, type a short, meaningful commit message that describes the change you made to the file. You can attribute the commit to more than one author in the commit message. For more information, see «Creating a commit with multiple co-authors.»
- Below the commit message fields, decide whether to add your commit to the current branch or to a new branch. If your current branch is the default branch, you should choose to create a new branch for your commit and then create a pull request. For more information, see «Creating a new pull request.»
- Click Propose file change.
Renaming a file using the command line
You can use the command line to rename any file in your repository.
Many files can be renamed directly on GitHub, but some files, such as images, require that you rename them from the command line.
This procedure assumes you’ve already:
- Created a repository on GitHub, or have an existing repository owned by someone else you’d like to contribute to
- Cloned the repository locally on your computer
- Open TerminalTerminalGit Bash.
- Change the current working directory to your local repository.
- Rename the file, specifying the old file name and the new name you’d like to give the file. This will stage your change for commit.
$ git mv OLD-FILENAME NEW-FILENAME
- Use
git status
to check the old and new file names.$ git status > # On branch YOUR-BRANCH > # Changes to be committed: > # (use "git reset HEAD ..." to unstage) > # > # renamed: OLD-FILENAME -> NEW-FILENAME > #
- Commit the file that you’ve staged in your local repository.
$ git commit -m "Rename file" # Commits the tracked changes and prepares them to be pushed to a remote repository. # To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.
- Push the changes in your local repository to GitHub.com.
$ git push origin YOUR_BRANCH # Pushes the changes in your local repository up to the remote repository you specified as the origin
Вопрос
Я смог найти на сайте GitHub способ переименовать один файл и сделал это с успехом.
Я также смог найти способ переименовать целый репозиторий и сделал это с успехом.
Кто-нибудь знает, как сделать это с одним каталогом без использования командной строки? Для справки, я пытаюсь изменить каталог с именем InterviewTesting (который содержит файлы src и т.д.) на что-то другое. Я пробовал сделать это однофайловым способом.
Но это не позволило мне изменить имя каталога (InterviewTesting), только фактическое имя файла.
Ответ на вопрос
6-го августа 2015 в 5:13
2015-08-06T17:13:10+00:00
#28307861
В веб-приложении GitHub нет возможности сделать это. Я считаю, что единственный способ сделать это — в командной строке с помощью команды git mv <old name> <new name>
или с помощью клиента Git (например, SourceTree).
Ответ на вопрос
18-го октября 2017 в 7:40
2017-10-18T07:40:50+00:00
#28307864
Вы можете!
Просто нажмите «Редактировать» как на @committedandroider’ы оригинальный пост, а затем нажмите клавишу Backspace курсор в начало имени файла. Это позволит изменить папку. Когда закончите нажмите косую черту, чтобы потом снова редактировать именем.
Ответ на вопрос
26-го апреля 2018 в 8:42
2018-04-26T20:42:48+00:00
#28307867
У меня была проблема с GitHub хватает на некоторые чувствительны к регистру изменения в папки. Мне нужно, чтобы сохранить историю миграции, пример того, как я поменял на «basicApp» в папку в GitHub, чтобы «basicapp и»
ЗЫ: ГИТ Общ-файлов
покажет вам, как GitHub видит ваше имя папки
Ответ на вопрос
20-го ноября 2018 в 4:34
2018-11-20T16:34:50+00:00
#28307879
В качестве новых пользователей к Git, я взял следующий подход. Из командной строки, я смог переименовать папку, создать новую папку, копировать в нее файлы, добавление и установка локально и тужиться. Вот мои действия:
Наверное, лучший способ, но он работал для меня.
Ответ на вопрос
1-го июня 2019 в 3:27
2019-06-01T15:27:09+00:00
#28307882
Перейдите в каталог и нажмите на кнопку ‘настройки’ рядом с маленьким винтиком. Есть поле для переименования каталогов.
Ответ на вопрос
29-го мая 2018 в 3:59
2018-05-29T03:59:00+00:00
#28307876
Если у вас есть на GitHub рабочем столе, изменить имена каталогов на вашем компьютере, а затем нажмите Обновление с компьютера в свой аккаунт GitHub и это меняет их.
Надеюсь, что это помогает!
Ответ на вопрос
17-го февраля 2016 в 3:34
2016-02-17T03:34:07+00:00
#28307863
Я изменил имя ‘Untitlted Folder’, поднявшись на одну директорию вверх, где перечислены папка без названия и другие документы.
Отметьте маленький белый квадратик напротив ‘Untitled Folder’, вверху появится кнопка ‘rename’. Затем нажмите и измените имя папки на любое извращенное имя, которое вы хотите.
Видите кнопку ‘Переименовать’?