Is there a way to change the name of a gist (github) ?, apparently it is ordering the files of the gist in alphabetical order, an naming the gist according to the file that appears first.
GitHub Gist – How to Change the Name of a Gist
gistgithub
Related Solutions
There are various possible interpretations of what is meant by renaming a Git repository: the displayed name, the repository directory, or the remote repository name. Each requires different steps to rename.
Displayed Name
Rename the displayed name (for example, shown by gitweb
):
- Edit
.git/description
to contain the repository's name. - Save the file.
Repository Directory
Typically (with exceptions for worktrees and submodules explained below), Git does not reference the name of the directory containing the repository, so we can simply rename or move it:
- Open a command prompt (or file manager window).
- Change to the directory that contains the repository directory (i.e., do not go into the repository directory itself).
- Rename the directory (for example, using
mv
from the command line or the F2 hotkey from a GUI).
Moving a repository that has worktrees
If you have created worktrees using the git worktree
subcommands from the repository that is to be renamed, then each worktree directory will contain a .git
file that contains
gitdir: {full-path-to-parent-repository}/.git/worktrees/{worktree-name}
So if you move the location of the parent repository, for each such worktree you will also need to edit its .git
file to change the parent path.
Moving a directory that is a worktree
Use the git worktree move
command from the parent repository.
Moving a repository that has submodules
Similarly to the worktree case, the submodule directory has a .git
file pointing to its parent. The parent also has a .git/modules/{submodule}/config
file which may contain absolute paths that need to be edited. See also this question.
Renaming a submodule
Use git mv
as discussed in this answer.
Corner cases involving both submodules and worktrees
Don't do that. If you must, read the docs for git worktree repair
and probably also the docs for submodules to understand how they are implemented.
Remote Repository
Rename a remote repository as follows:
Go to the remote host (for example, https://github.com/User/project).
Follow the host's instructions to rename the project (will differ from host to host, but usually Settings is a good starting point).
Go to your local repository directory (i.e., open a command prompt and change to the repository's directory).
Determine the new URL (for example,
[email protected]:User/project-new.git
)Set the new URL using Git:
git remote set-url origin [email protected]:User/project-new.git
It is possible to create a git repository directly in a folder, without the subdirectory .git
. To do this, you do this:
mkdir myrepo.git
cd myrepo.git
git init --bare
This is called a bare repository - it contains the contents of what would normally be in a .git
folder. It has no working copy. These sorts of repositories are usually used in the remote server (where you're pushing your changes); i.e., when your remote repository basically reflects what you've committed locally, and nobody is working directly on the code in the remote server location (therefore no need for a working copy.)
More detail:
Best Answer
Even better, you can add a file with a leading space in its name. It's virtually invisible and gives you more freedom when choosing the title and names for the files: