---
# System prepended metadata

title: Git/Github

---

# Git/Github

## step 1: clone a repo
```shell
$ git clone <repo url>
``` 

## step 2: change directory to repo
```shell
$ cd <repo name>
``` 

## step 3: create a new branch
```shell
$ git checkout -b <branch name>
``` 

## step 4: when you want to add your changes  
```shell
$ git status
$ git add <modified file name>
$ git commit -m 'write message here #<issue number>'
``` 

## step 5: pull main
```shell
$ git checkout main
$ git pull origin main
``` 

## step 6: merge master with your branch
```shell
$ git checkout <branch name>
$ git merge main
```  

- fix the conflict if exists, then repeat **step 4**
- if your branch is already up to date then continue to **step 7**


## step 7: push your changes to github repo
```shell
$ git push origin <branch name>
```
