Git create a patch from fuzzy commits

I can’t click when I work remotely, so I want to create one patch from all the commits that have not yet been clicked in my development branch to send it by email. How to do it?

+6
source share
2 answers

git format-patch <commit-ish> creates a patch file for each commit made from the specified commit.

So, to export all of your uncommitted commits, just put

 git format-patch origin/master -o patches/ 

and they will all be listed in the patches/ directory.

If you want to have a single file , add --stdout :

 git format-patch origin/master --stdout > patches_$(date -I).patch 

This will create a file called patches_2014-10-03.patch (or another date) with all your patches. Beware: patch or other simple patch applications cannot handle the created file. It will only work with git am .


Sidenote:
A simpler (and more reliable) thing may be to keep a copy of your repo on your thumb or the like. Then configure the multiplexer as a remote control ( git remote add thumb /media/thumbdrive ), push your fixes on it ( git push thumb master ) and return to your company, pull it out of the drive and click on start.

+10
source

Instead of creating a patch, you can create a package (i.e. a file representing the git repository from which you can pull).
In your case, an incremental package is required.

 git bundle create ../yourRepo.bundle" --since=x.days.ago --all 

Change x to the number of days that you want to put into this package: do not be afraid to insert "too mein" in this repo: someone cloned from your package, will receive only new commits, instead of which he already had in the local repo.

A package is a single file, such as a patch, but can be used as a git repository: it is easy to copy and easy to use (like a regular git repository).
If your only use is to complete the local repo with a commit made from a remote repo (from which you cannot directly click), this is easier than patches.

+3
source

Source: https://habr.com/ru/post/976199/


All Articles