megacolorboy

Back

Published on April 10th, 2021

Git

Fetch selected files from your remote repository

Wanted to fetch a specific file from your Git repository except that the repository doesn't exist in your local machine?Try this out:After executing these commands, you should be able to see the selected directory/file in your project directory.Hope you found this useful!

1 minute read

Wanted to fetch a specific file from your Git repository except that the repository doesn't exist in your local machine?

Try this out:


git init
git remote add origin <your_repo_link>.git
git fetch
git checkout <your_branch_name> -- </path/to/file>

After executing these commands, you should be able to see the selected directory/file in your project directory.

Hope you found this useful!