git pull specify a particular file or folder

1, to solve the problem

By default, all the latest data will operate a remote repository git pull updates locally.

But if you want a particular file or update the specified folder, how does it work?

2, git pull only one file / folder

  • Set  core.sparsecheckoutto true

$ git config core.sparsecheckout true
  • core.sparsecheckoutPull provided for controlling whether to allow the specified file / folder, true is allowed.

  • This method is suitable for Git1.7.0 later, the previous version without this feature.

  • In the .git/info/sparse-checkoutdocument (if not create) Adds the specified file / folder

  • Finally, you want to pull a branch can be realized checkout specified file / folder.

 $ git pull origin master

 

Guess you like

Origin www.cnblogs.com/liugp/p/11310124.html