git commit --amend ----no-edit
[alias]
fixup = !sh -c 'SHA=$(git rev-parse $1) \
&& git commit --fixup $SHA \
&& git rebase -i --autosquash $SHA~' -
Usage : git fixup {sha1} to add in .gitconfig
See Git Damnit for explanations about working directory, index and Head.
3 options for git reset:
-
Keep changes, indexed (staged)
git reset HEAD~ --soft
-
Keep changes non indexed (unstaged)
git reset HEAD~ --mixed
git reset HEAD~
-
Delete all changes
git reset HEAD~ --hard
git fetch origin feature1 git reset --hard origin/feature1
As an alias:
[alias]
dammit = !BRANCH=$(git rev-parse --abbrev-ref HEAD) \
&& git fetch origin $BRANCH \
&& git reset --hard origin/$BRANCH
Usage : git damnit
See here for explanation
\\Don't forget tilde (parent of E)
git rebase E~ --onto master
E~ : rewrite from commit E --onto master : on master branch
git checkout -