George
George

Reputation: 7327

Ignoring a subfolder on a git pull (but not on a git push)

In my git repository there is a subfolder ./foo.

Question: Is it possible to ignore foo when running a git pull, but not ignore foo when running a git push?

Upvotes: 0

Views: 59

Answers (1)

user3159253
user3159253

Reputation: 17455

The shord answer: no. Git unlike e.g. SVN doesn't operate with commits on folder level.

The long answer: since a given file tree is an undisposable part of a given commit, you can't pull a given commit w/o part of the commit.

But you can instead do as follows:

git fetch <remote>
git merge --no-commit <required remote branch>
[edit the changes of the merge as you need, use git checkout <revision> -- <path> etc..]
git commit

Or there're other possible ways to solve your problem :)

Upvotes: 1

Related Questions