Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving image files in Github to folder

Tags:

git

github

I am moving my website to Github Pages, but have made a mistake in not keeping the same folder names. Instead I just uploaded every file to the main repository. My repository is here : https://github.com/akinhwan/akinhwan.github.io

I am aware of how to change the file directories of text files, by clicking the edit icon and adding a root name and "/". However image files do not appear to have this option.

How might I use github, git shell or github desktop to move my many image files to a subfolder /img so that my html will be able to find my image files?

Thanks everyone!

like image 909
Akin Hwan Avatar asked May 03 '16 14:05

Akin Hwan


1 Answers

To do this using command-line git,

  • Type git clone https://github.com/akinhwan/akinhwan.github.io to download a local copy of the repository, then cd akinhwan.github.io to go into that directory.
  • Make a directory called img by running mkdir img.
    • Create extra directories in this way as necessary if you need to reorganize any other types of file.
  • Move the images into the new directory by running git mv *.jpg *.png *.gif img/
    • This can be done for individual files like git mv file.png destination/
  • Once you are happy with what you have moved (use a graphical file manager if necessary to review the locations of moved files, and use git status to see what you have changed), run git commit -m 'Move image files to /img' or similar to make a new commit which moves your files to their correct locations.
  • Push the commit to the repository on GitHub by running git push and entering your credentials.
like image 174
Candy Gumdrop Avatar answered Oct 13 '22 18:10

Candy Gumdrop