Create a new commit from patches without using any worktree?
- From
- Klas Lindberg <klas.lindberg@gmail.com>
- Date
- Oct 27, 2010, 01:49 UTC
- Message-ID
- <AANLkTi=Xi13_0+bC-TVRP3uVDmGWVdM3a708=SSzCR88@mail.gmail.com>
Hello
Is there any way to record a new commit based on contents in a patch without going through a worktree? Of course the operation would have to fail if the patch does not apply cleanly. The problem is I find myself doing things like this:
put away current work on some branch A checkout some branch B that is only used for patching run git patch --check to see if patches apply cleanly. *reject* if not. apply otherwise. return to branch A.
I.e. the checkout of B is redundant because I'm anyway not going to try to resolve any conflicts.
I know I can do something similar to what I need with "git-fetch src:dst", except it's rather awkward if what you have is patches. I suspect there must be some way to mimic that fetch behaviour manually, and in a way that lets me choose exactly what to apply?
BR / Klas