0

I want to do automatic(no manual intervention) git pull from git remote repository.

But that some files are kept in local state and all others are same as in remote repository.

I have found How do I force "git pull" to overwrite local files?

The solution from that answer is:

git fetch --all

git reset --hard origin/master

But this is overwriting all files in the local directory to state from origin/master.

How can I do this, but with excluding some files?

More info: I am making one deployment script (I know that fabric/git is not the best solution, but if I can do this than it is good enough for me.)

Community
  • 1
  • 1
WebOrCode
  • 6,852
  • 9
  • 43
  • 70

1 Answers1

0

This is what I use in my fabric script:

run('git stash') 
run('git fetch') 
run('git reset --hard origin/master') 
run('git stash pop')
WebOrCode
  • 6,852
  • 9
  • 43
  • 70