Last updated about 1 week ago

Git

Stash

Stash the changes in a dirty working directory away

Rebase

Make it look like your commit(s) were made on top of the latest head

Manual Rebase

Tags

Mark a point in commit history (useful for releases and such)

Submodules

Make a repository a subdirectory of another repository

Worktrees

Make a directory for each working branch

Log

Git log can be used in conjunction with touch command to reset file timestamps to match their last motified times:

touch -d $(git log -1 --pretty="format:%ad" --date=format:'%Y-%m-%d%H:%M:%S' $file) $file

Maintenance

Run tasks to optimize Git repository data, speeding up other Git commands and reducing storage requirements for the repository.

~ git-scm.com/docs/git-maintenance

cd my-repository
git maintenance run

Multi-account setup

docs.github.com

# Generate ssh key for <other> account
ssh-keygen -t ed25519  -f ~/.ssh/other-account -C "Key for other-account"

# Copy the publick key
cat ~/.ssh/other-account.pub

# Add it to your Github <other> account as Authentication Key on
# https://github.com/settings/ssh/new

# Update your ssh_config as follows:
cat <<EOF >> ~/.ssh/config

Host github-other.com
  IdentityFile ~/.ssh/other-account
  Hostname github.com
  User git
  IdentitiesOnly yes
EOF

# Test if it works
ssh -T git@github-other.com

# Ensure your other-account repos are configured by the other-account email
git config user.email "other@account.com"