Git fetch only one directory -


i have developer works on 1 folder , works on another. update production specific folder i'm looking command like:

cd /myproject git pull myfolder 

and expect myfolder updated

is possible?

ok, i'll rephrase... have 1 project, 1 branch , 2 developers , 2 folders in project. each developer works on 1 folder. both make changes , push them branch.

i want pull changes of 1 folder local machine

basic/simple isn't it?

assuming you're asking remotely grab files git repository, without having working tree of own (or clone of repository locally), this:

git archive --format=tgz --remote=<url-to-repo> master -- myfolder | tar zxvf - 

this says create gzipped tar ball of master branch of repository living @ <url-to-repo>, include contents under myfolder. piping through tar unarchive data , put in current working directory.

if you're trying manage working tree , work other 2 developers, you're asking goes against grain of tool. you'd have more elaborate you're trying accomplish in order make workflow suggestion.

update:

so sound if want fetch 1 folder's changes in managed working tree. sorry, git not operate way. said in comments below, git manages trees of files. not allow part of tree @ 1 revision, , part @ different revision you're suggesting--perhaps previous user of subversion possible?

you can effect similar want, have modify working copy. not commit modification unless want discard 1 of developers work. this:

$ git fetch $ git checkout @{u} -- myfolder 

git fetch bring remote references date--it fetch latest information servers. git checkout @{u} -- myfolder make myfolder exists in tracking branch. has 2 consequences:

  • you not have changes on local branch (and didn't want them, that's okay), and

  • myfolder show being modified because content of myfolder has been updated latest available remote repository, not same current revision.

to working copy normal, this:

$ git checkout -- myfolder 

from there, call follow usual mechanism getting branch up-to-date remote (likely git pull).

this, however, not how want operate. despite comment, "doesn't matter use case", matter. there better ways accomplish overall goal , manage development, requires understanding you're trying do. @ moment, propose goes against how git intended work.

so let me put few things out there you. research using topic branches way manage development work being done, rather using folders each developer in tree. clear, logical changes can made on branches , merged test , approve them inclusion production.

a place start here. contains fair amount of information itself, , follow on links several different styles of git workflows. place want end there commit represents version put production, without destroying work others doing you. ideally, you'd tag pushed production in meaningful way.

i know no 1 likes hear it, training may helpful in case. github offers free online classes several other resources. judging experience, once grasp how git works , problems solves, you'll end better workflow.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -