Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tksst/64e5184ff41e4e01bdf4eaa98001eaf6 to your computer and use it in GitHub Desktop.
Save tksst/64e5184ff41e4e01bdf4eaa98001eaf6 to your computer and use it in GitHub Desktop.
Gitで過去のコミットをまとめてreset-authorする
git rebase -i <commit> --exec "git commit --amend --reset-author --no-edit --allow-empty --allow-empty-message"

git rebase:

--exec

Append "exec <cmd>" after each line creating a commit in the final history. <cmd> will be interpreted as one or more shell commands. Any command that fails will interrupt the rebase, with exit code 1.

git commit:

--reset-author

When used with -C/-c/--amend options, or when committing after a conflicting cherry-pick, declare that the authorship of the resulting commit now belongs to the committer. This also renews the author timestamp.

--no-edit

Use the selected commit message without launching an editor. For example, git commit --amend --no-edit amends a commit without changing its commit message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment