# 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 <a href="http://user.name" rel="nofollow noopener" target="_blank">user.name</a> "John Smith"`

##### Change git user email globally

`git config --global <a href="http://user.email" rel="nofollow noopener" target="_blank">user.email</a> "<a href="mailto:john@smith.com" rel="nofollow noopener" target="_blank">john@smith.com</a>"`

##### 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>`