Skip to content

Instantly share code, notes, and snippets.

@clns
Last active March 14, 2023 15:17
Show Gist options
  • Save clns/c8f72b0c66ab458c6341 to your computer and use it in GitHub Desktop.
Save clns/c8f72b0c66ab458c6341 to your computer and use it in GitHub Desktop.
Git commands
Quickly open git source code
vim $(git --exec-path)/git-rebase--interactive
Automatically change "pick" to "reword" in a rebase
GIT_SEQUENCE_EDITOR="sed -i '' -e 's/^pick/reword/g'" git rebase -i --root
Reset/change author
GIT_SEQUENCE_EDITOR=: git rebase -i YOUR_SHA -x "git commit --amend --reset-author -CHEAD"

http://stackoverflow.com/a/25815116/1104534

Set committer date to author date for all commits
git filter-branch --env-filter 'GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE; export GIT_COMMITTER_DATE'

http://stackoverflow.com/a/11179245/1104534

Edit commit message for all commits
git filter-branch --msg-filter 'sed -e "s/^fixup! //"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment