To completely delete a commit from a GitGit
Git is a version control system used to track changes on files and make it easier for multiple people to collaborate on the same set of files.
This note serves as a link to connect Git-related not... branch you can use the following command:
CURRENT_OS=$(uname -s)
if [ "$CURRENT_OS" = "Linux" ]; then
git rebase --rebase-merges --onto $1^ $1
fi
if [ "$CURRENT_OS" = "Darwin" ]; then
git rebase --rebase-merges --onto $1~ $1
fi
The $1
in the above command would be the commit sha of the commit you want to remove. Packing this into a zfunc named git-cherry-pit
, you'd use it like so:
git-cherry-pit 8b5515fdf49feea83ad6fe9c0ad4a9e81abe9f86
Status: #🌲
Part of Git RunbooksGit Runbooks
This note serves as a collection of [[Git]]-related how-to guides that lead you through the steps of solving real-world problems. To use it, follow the linked mentions below.