Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share local changes without git push?

Tags:

git

I'm using git in my project. Sometimes I need to share my modified changes with my colleagues or to different PC, but I don't want to push those changes. He will take my code and modify something and then will push that code. For now I manually give him file via mail or send in pen drive. I want this to be done via git. Can I do like git commit and then share without git push?

like image 714
vivek nuna Avatar asked Jun 10 '17 19:06

vivek nuna


1 Answers

You can save the changes to a patch file with

git diff > /path/to/file.patch

This supposes that your changes are unstaged. Use git diff --cached if they are staged. I would not commit them, since your colleague is going to do that and you'll run into conflicts otherwise.

You can send this file via mail or whatever, and your colleague can apply those changes with

git apply /path/to/file.patch
like image 181
Manuel Schmidt Avatar answered Oct 23 '22 01:10

Manuel Schmidt