Domanda

I cloned a Gist from GitHub to my desktop by dragging the link.

However the folder name is the undescriptive long number.

How can I rename the folder and still be able to continue committing updates from that folder to that Gist on GitHub?

Is it possible at all?

È stato utile?

Soluzione

Simply rename the folder! git does not care about the name of the folder, it only requires that there is a .git-folder inside.1 You can even provide the name of the folder to clone into a second parameter to git clone:

git clone repository name-of-folder

Also see this shell transcript to see that git does not care about the name:

[timwolla@/tmp]git clone https://gist.github.com/9028551.git
Cloning into '9028551'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
Checking connectivity... done
[timwolla@/tmp]mv 9028551/ example-folder/
[timwolla@/tmp]cd example-folder/
[timwolla@/tmp/example-folder master]touch otherfile
[timwolla@/tmp/example-folder master]git add otherfile
[timwolla@/tmp/example-folder master]git commit -m "Add otherfile"
[master 5f80cf2] Add otherfile
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 otherfile
[timwolla@/tmp/example-folder master]git push
Username for 'https://gist.github.com': timwolla
Password for 'https://timwolla@gist.github.com': 
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 289 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://gist.github.com/9028551.git
   47890af..5f80cf2  master -> master

For reference, this is the gist: https://gist.github.com/TimWolla/9028551

1 Technically don't even that

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top