Search code examples
gitgithubrepository

How do I make the content of a folder visible directly in a Git repository?


I don't like having all the content of my repo into a folder. How can I put its content directly at the root?

Here is what the repo looks like:

enter image description here

enter image description here


Solution

  • Currently, the carrot-market folder is at the root of your repository. If you want the content of it to be at the root, you need to:

    1. Create a new branch with git checkout -b my_new_branch (doing stuff in a new branch in case something goes wrong)
    2. Move the content of carrot-market out of it, at the root of the repo with git mv carrot-market/* .
    3. Delete the carrot-market folder
    4. Commit all the changes with git commit -a -m "Put files from carrot-market folder directly at the root"
    5. Push your changes with git push -u origin my_new_branch (assuming the remote is called origin)

    Now, if everything looks the way you want in your new branch, you can merge it to your main branch.