Git use SHA1 for checksum
SHA1: 160 bit → 40 hex char
- If you don’t want to type it every single time you push, you can set up a “credential cache”. The simplest is just to keep it in memory for a few minutes, which you can easily set up by running
git config --global credential.helper cache.
Back up git branch
To back up a branch before taking any destructive action, like a rebase or force push:
- Open your feature branch in the terminal:
git checkout my-feature - Create a backup branch:
git branch my-feature-backupAny changes added tomy-featureafter this point are lost if you restore from the backup branch.
Your branch is backed up, and you can try a rebase or a force push. If anything goes wrong, restore your branch from its backup:
- Make sure you’re in the correct branch (
my-feature):git checkout my-feature - Reset it against
my-feature-backup:git reset --hard my-feature-backup