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
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)
Last updated