git add some_file git commit -m "Commit message that will show in patch." git format-patch -1 0001-Commit-message-that-will-show-in-patch.patch
Suppose the following incremental patches from A
to B
:
to delete C
, one would issue:
git reset --hard HEAD~1
the result is the following:
another git reset –hard HEAD~1
would yield:
git reset --hard e484904
or for SHA:
git reset --hard 3f786850e387550fdab836ed7e6dc881de23001b
Rebasing is good when local changes are not important enough to be merged into the main development branch. The procedure is as follows:
mybranch
and assume that the parent branch is named master
:git clone https://github.com/repo -b mybranch
git config --global --bool pull.rebase true
to globally turn on rebasing.
git pull repo master
, the changes should be merged in and your patches applied on top of the pull, effectively merging the changes.git config --global user.name "John Doe" git config --global user.email john@example.org
If you get the following error when doing a git pull
:
Please, commit your changes or stash them before you can merge.
and you do not want to stash the changes, simply issue:
git reset --hard git pull
to overwrite any local changes.