# Special usecases

#### rename branch

* `git checkout <old_name>`
* `git branch -m <new_name>` (move/rename the local branch)
* `git push origin -u <new_name>` (push new branch to remote)
* `git push origin --delete <old_name>` (remove old branch from remote)


#### clone repo in existing folder

* with clone:
```bash
git clone https://myrepo.com/git.git temp
mv temp/.git code/.git
rm -rf temp
```
* without clone (use fetch):
```bash
git init
git remote add origin {{url_of_clone_source}}
git fetch origin
git checkout master # delete files that are blocking
```