Background and application scenarios
The previous hash is not working for some reason and a patch needs to be submitted. I want to type this patch on the [Hash] submission?
define
- [hash] : indicates a commit whose value is hash
- [hash’] : indicates the previous commit of [hash]
- Patch: this is not the same as the commit, can be thought of as a patch, is a historical commit of a patch
steps
- Get your patch ready
- Git stash: Temporarily store the patch to make git rebase
- Git rebase -i ([hash] before [hash’]) : displays all commits before [hash’]
- Select the target you want to hash the patch to, which in this case is the first
- Place the entries in
pick
Instead ofedit
- Git stash pop: Pops the patch
- Git add. Add patch to staging area
- Git commit — Amend: Recommit the staging area to the previously specified hash and edit the commit information
- git rebase –continue