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
git symbolic-ref refs/heads/branch-alias refs/heads/original-branch-name # Create or update alias
git symbolic-ref --delete refs/heads/branch-alias # Delete alias
Misc
Commit parts of a file
git add --patch <filename-is-optional># And then there is a prompt “Stage this hunk [y,n,q,a,d,/,j,J,g,s,e,?]?”# y - yes, n - no, s - split into smaller hunks
Commit a fixup for the latest commit
git commit --fixup=HEAD
git rebase -i main --autosquash # rebase automatically marks the previous commit as fixup
Empty commit
git commit --allow-empty -m "Trigger Build"
Undo latest commit
git reset HEAD~
Cherry pick all commits from a branch
git cherry-pick StartCommit^..EndCommit # “^” is needed to include the StartCommit too
Abort git rebase in Vim
:cq
Reset auhtor and commit date
git commit --amend --reset-author --no-edit
Reset auhtor and commit date for multiple commits in a branch
git rebase -i <commit-hash> -x "git commit --amend --reset-author --no-edit"