I started my local repository on bitbucket, but the folder (not empty) that was not added to it. How to push it? I use the program Git GUI

    1 answer 1

    Git does not version folders on its own, only files. To add a folder, you need to add at least one file from it.

    # Можно добавить всё содержимое папки git add foo # но достаточно хотя бы одного файла git add foo/file.txt git commit -m'message' # теперь папка добавлена 

    If there are no files in the folder, then it is generally accepted practice to create a file with the name .gitkeep (the dot at the beginning is important).

     # создаём пустой файл любым способом, например через touch touch foo/.gitkeep git add foo/.gitkeep git commit -m'message' 

    If you have completed the instructions above, but do not see the folder when browsing files on Bitbucket (or GitHub, GitLab, etc.), check the currently selected branch. All of these services show the status from the master branch by default. If your folder has been added to another branch, you need to switch to viewing this branch.

    • Thanks, made a git add folder and the folder was added - MyNick
    • @MyNick as everything just turned out, my descriptions of special cases were not useful)) - Nick Volynkin
    • May still come in handy in the future. I couldn't do it with Git GUI - MyNick
    • @MyNick what exactly could not do? - Nick Volynkin
    • Add the internal folder of the local repository to Bitbucket. How to make git add folder using Git GUI? - MyNick