Luc
Luc

Reputation: 2805

Git - How to pull exclude directory

My Git server has 2 branches:

Foo and Master

In Branch Foo:

Directory1

Directory2

In Branch Master:

Directory2

As you can see, in Branch Master, there is no Directory1.

Now, in directory 2 has changes in branch Foo

I am in branch Master, I would like to get changes from Foo* without **Directory1. How should I do?

Upvotes: 0

Views: 1373

Answers (1)

Mad Physicist
Mad Physicist

Reputation: 114548

Git allows you to pull specific files and directories using checkout:

git checkout Foo -- Directory2

will pull just the Directory2 folder from Foo branch. -- tells git that everything that follows is a path spec.

If you want to do a true merge, follow one of the answers to this question: How do I merge a sub directory in git?

Upvotes: 1

Related Questions