Pregunta

Someone sent me the output of a diff of my remote and their local. My local is a clone of the remote with no changes. What is the best way to apply the diff to my local without manually going through it and making each change?

diff --git a/path b/path
¿Fue útil?

Solución

The git apply command will take a patch and apply it to your local directory. There is some good discussion here, and of course also the git-apply documentation.

Otros consejos

It depends on your workflow you can use git apply to apply a properly formatted patch. Alternatively you could have the other party push to a shared branch git push origin <branch> and you could pull their branch down and merge/rebase the changes. Both of these are functionally equivalent, but the second option sports a little recordkeeping regarding your code sharing arrangement.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top