Reputation: 5565
I have the following directories in my git repository.
home
client
server
I want to overwrite my changes in my home
directory with the corresponding content in the repository. It should not affect the other two directories.
I tried to use git pull origin master home
, and git checkout origin/master home
. But none is doing what I need to do.
Upvotes: 0
Views: 32
Reputation: 16647
Git was not designed to allow you to have a checkout of different commits in different directories (unlike Subversion). Git considers your project as a whole.
If you need to temporarily get one version for home/
and another version for the rest of your project, you can use
git checkout <commit-id> -- home/
(Warning: erases all changes in home/
)
But the next commit you make will consider changes from your working tree to the base commit for the whole project, hence would consider what you have checked-out in home/
as changes, and commit this. You probably don't want that.
If you really need to play with different versions for different directories, then you should consider splitting your repository into several submodules.
Upvotes: 1