Skip to main content

Git

Push commits to another branch
git push origin <branch with new changes>:<branch you are pushing to> 
List git config settings
git config --list

Change git user for single repository

git config user.name "John Smith"

Change git user email globally

git config --global user.email "[email protected]"

Checkout to old commit

git checkout <commit hash>

Change git case sensitivity(default is true)

git config core.ignorecase false

Restore to certain commit

git reset --hard f170a0c
git push -f

Change origin URL

git remote -v
git remote set-url origin <url>

Reset one file

git checkout HEAD -- <files>

Clone specific branch

git clone -b <branch> <repo-url>

Show commit diff

git show <commit-hash>