22
loading...
This website collects cookies to deliver better user experience
$ git commit --amend --no-edit
$ git add -p <filename>
add -p
(or git add --patch
) you can choose which parts of code from a file you want to include in your commit. After running the command you will get the list of the options you can add to git add -p
s
you can split the hunk into smaller pieces. From there you can simply choose the chunks you want to stage for commit (and omit those you don’t) by navigating with y
and n
(or go for any other option from the list).$ git reflog
HEAD@{index}
represents the specified commit, so just replace index with the correct number and run:$ git reset HEAD@{index}
git reset
is git reset --mixed
. It means that the changes in your working directory will be preserved but not staged (since the index was modified to match the chosen commit, the changes are not in the index anymore).$ git reset --soft
# Doesn’t modify the index or the working tree, leaving your changes staged for commit.
$ git reset --hard
# Use with caution, as it resets both the index and working tree. Uncommitted changes and all commits after will be removed.
$ git checkout --conflict=diff3 <filename>
$ git config --global merge.conflictstyle diff3
$ git config --global help.autocorrect <integer>
22