Skip to main content

Git

Rollback last commit in a local git repository​

Revert the last commit in a local git repository
git reset HEAD~1

Revert the last commit from GitHub remote repository​

Revert the last commit from remote repository
git checkout <branch-name>

# Revert 1 commit from remote
git push --force origin HEAD~1:<branch-name>

Set local repo user name and email​

git config user.name "Your Full Name Here"
git config user.email [email protected]

For (global) default email (which is configured in your ~/.gitconfig):​

git config --global user.name "Your Name Here"
git config --global user.email [email protected]

Ask password on each time​

git config credential.helper store