tags:

views:

47

answers:

2

I have a build system that I use to test the code I am currently working on. I would like the build script to pull the current code as quickly as possible from my workstation's git repo.

I'm looking to quickly pull any changes from origin/master along with any modified files.

+2  A: 

Pretty much by definition, modified files are not tracked. (Uncommitted modifications are, well, uncommitted.) You could certainly directly copy the work tree if you had access, but otherwise, if you want to pull it, you need to commit it. You could commit it to a temporary branch, of course, but somehow it's got to be committed.

Edit: This answer is about pulling with git. If you want to copy files (or copy a diff) as in the OP's answer, you can do that, but the bottom line is that it's an operation requiring filesystem access, not a git remote operation.

Jefromi
its more efficient to pull the committed changes with git and then pull the diffs after that. it is NOT necessary to commit a change before pulling it (see my answer)
Arthur Ulfeldt
@Arthur Ulfeldt: It really depends what you mean by "more efficient". It means you have to have a publicly accessible non-bare repo, and be in immediate communication with its owner in order to know when it is in the right state for your modified pull, rather than letting them mark a certain state as ready for (unstable, testing) pull by committing it. Commits do have a purpose, I promise, and they're quite easy to blow away if they turn out not to be what you wanted.
Jefromi
Oof, a downvote? My answer is, strictly speaking, correct, even if it is possible to circumvent git and pull in this manner.
Jefromi
I bare repository cant have modified files to begin with. in this case I am starting the build so coordination is not really a problem. You do seem to be correct about not being able to do this with just git.
Arthur Ulfeldt
+2  A: 

first pull the commited changes then pull a diff of the uncommitted changes.

git pull
ssh me@my-dev-box bash -c "cd && cd svn && git diff HEAD /home/aulfeldt/svn" | patch -p1
Arthur Ulfeldt
To include the staged files, diff against HEAD instead of the index.
Jefromi
thanks :) that really makes my day!
Arthur Ulfeldt
Note that in addition to the restrictions I mentioned in the comment on my answer, this requires shell access to the repo in question. This is completely opposite to the way shared repositories are usually set up - bare, and with access only through git-shell.
Jefromi