I cannot push when working remotely, so I want to create a single patch from all the commits that have not yet been pushed on my develop branch to email it. How do I do that?
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
git format-patch <commit-ish>
creates a patch file for every commit you made since the specified commit.So, to export all your unpushed commits, simply put
and all of them will be output into the
patches/
directory.If you want to have a single file, add
--stdout
:This will create a file named
patches_2014-10-03.patch
(or another date) with all your patches in it. Beware:patch
or other simple patch applications cannot cope with the produced file. It will only work withgit am
.Sidenote:
An easier (and more robust) thing to do might be to keep a copy of your repo on a thumbdrive or similiar. Then set up the thumbdrive as a remote (
git remote add thumb /media/thumbdrive
), push your commits to it (git push thumb master
) and when back at your firm, pull from the drive and push to origin.Instead of creating a patch, you could create a bundle (meaning a file representing a git repo, from which you will be able to pull).
In your case, an incremental bundle is needed.
Replace
x
by then number of days you want to put in that bundle: don't be afraid to put "too mayn" days in that repo: someone cloning from your bundle will get only the new commits, not the one he/she already had in the local repo.A bundle is a single file, like a patch, but can be used as a Git repo: easy to copy around and easy to use (as a regular Git repo).
If your only use is to complete a local repo with commits done from a remote repo (from which you couldn't push directly), this is easier than patches.