Skip to main content

Command Palette

Search for a command to run...

A cool way to hide your files in a git folder

Published
β€’2 min read
A cool way to hide your files in a git folder

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

169 views
A

I was expecting a secret trick. But i guess this will do the work as well.

Great article anywayπŸ‘

2
M

Thanks

T

Never thought of this one as a got usecase so far...😁. Learned something.. Thanks for sharing πŸ‘

2
M

Thanks for reading 🀭

S

Haha.. cool trick. :)

2
M

😁😁 Thank you..