1

What's the best way in Git to save my local changes into some file format so that others can review it before I make the commit? I know one way to do this is to use git stash save -p and others can view the patch file. However, I was wondering if there's a better way, for example something like this would be nice:

git diff save > myfile

user1715925
  • 607
  • 9
  • 26

1 Answers1

0

I think local branch can be used in your scenario, which is also a significant advantage of git.

Saying you are working on master branch, just create a new branch called dev, do your work and commit as you wish on dev branch. If you want to send your local changes to others, just git diff the two branches and send out the results. Or you can even let others to pull your dev to have a review.

git diff master dev > myfile.diff

And if you want to push your changes to a remote central repository, just merge dev back to master and push. Git will help you do most of the work in the process.

PS. you guys may try some code review system integrated with git well such as Phabricator which is really fantastic and convenient.

Landys
  • 7,169
  • 3
  • 25
  • 34