Is there a way to update folder or file alone in Git? I had cloned from central repository and wish to update only specific folder/files.
To add and commit files to a Git repository Create your new files or edit existing files in your local project directory. Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed.
you can use git fetch
to update the objects in your local clone, and then you can git checkout
those particular files.
For example - if your remote is called origin and you only want to update main.c
from the master branch you can do this:
git checkout origin/master main.c
This will update the file in your working directory and add it to the index ready to be committed on your local branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With