Pergunta

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
Foi útil?

Solução

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.

Outras dicas

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 em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top