You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Revert a commit and leave the reverted files as staged changes
git revert -n <commit>
Show number of commits per author
git shortlog -sn
# Exclude merge commits
git shortlog -sn --no-merges
# Count from a specific date
git shortlog -sn --no-merges --since "01 January 2021"
Change the author or date of some unpushed commits
# Find the hash of the oldest commit to change and start an interactive rebase from that point
git rebase -i <hash># In the editor that starts, change the lines you want to modify from "pick" to "edit"# Save and close the editor# For each commit, to change author enter
git commit --amend --author="User Name <user@email.com>" --no-edit
# For each commit, to change date/time enter
GIT_COMMITTER_DATE="Wed Oct 25 10:00:00 2023 +0200" git commit --amend --date="Wed Oct 25 10:00:00 2023 +0200" --no-edit
# Proceed to the next commit
git rebase --continue