A cool way to hide your files in a git folder

A cool way to hide your files in a git folder

ยท

2 min read

As funny is it sounds, you can most definitely hide your files in a git folder...

Although this in not an ideal way of hiding files with git (and is not recommended for hiding sensitive documents), it is also a cool way of keep others from seeing your files, or knowing the exist.

Before doing this, you should be sure you have git bash installed.

To begin, open your terminal/command prompt and navigate to the directory you want to work on.

Initialize a git repo

git init

Make sure you are in the right directory

Create a new branch

git branch <new name>

Switch to the new branch

Now you have to switch to the new branch

git checkout <branch name>

Add all your documents

You can now add the files you want to this directory like you normally would

Track the new files with Git

Make git aware of your files and track the changes

git add .

Commit you new documents

At this point you will now have to commit(save) the files to git with a message

git commit -m <message>

Switch to old branch

you can now go back to the old branch that does not have your files

git checkout <branch name | master>

Now your files are successfully hidden ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰.

To view your files, switch to the branch that contains the files with

git checkout <branch name>

To learn more about git and git bash commands checkout sites

Feel free to do more. HAPPY CODING