# GitHub Usage

1- Before making any changes to files, you should follow this routine:

* Go to a branch which will be your base branch with "git checkout base\_branch"
* Update the branch you are in with "git pull" (if someone made any commits before you)
* Create and go to a new branch with "git checkout -b new\_branch\_name"
* Make your changes

```
git checkout base_branch
git pull
git checkout -b new_branch_name
```

2- Any local change that you want to send to github use:

* `git add .`
* `git commit -m "commit message"`
* `git push -u origin branch_name` (after first time only "git push" is enough)

3- Now that you pushed your branch to the GitHub, and it is tested on its own, you can merge with the base branch:

* Go to the base branch you want to merge  with "git checkout base\_branch" (usually master)
* At the base branch write "git merge new\_branch\_name"
* Resolve conflicts if there are.
* git add. + git commit + git push

4- Now that you merged with base branch you have two identical branches, which means you can delete the extra branch:

* git branch -d new\_branch\_name  ( deletes locally)
* git push origin --delete new\_branch\_name ( deletes branch in the GitHub)
