# git : notes d'utilisation pour un noob
HTML cheat sheet
## créer un patch
git format-patch --stdout HEAD^
## sync with fork
List the current configured remote repository for your fork.
```
git remote -v
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
```
Specify a new remote upstream repository that will be synced with the fork.
```
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
```
Verify the new upstream repository you've specified for your fork.
```
git remote -v
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
```
## Récupérer les modifs
```
git fetch upstream
git merge upstream/master
```
## Proposer une PR
Avant de proposer une PR, et même avant de commencer à faire des modifs, assure toi de bosser sur une branche spécifique et ensuite d'avoir une copie de travail à jour. Ce qui se resume :
Création de la branche:
```
git checkout -b nom-branche
```
Mise à jour de ta branche avec la branche de développement originelle
```
git pull origin dev
git pull upstream dev
```
Ça évitera d'avoir des PR qui contiennent des anciens commits et les conflits de branches.
Enfin, pour créer une merge request :
```
git push -o merge_request.create
```