# always start from master branch git checkout master # make sure you have the latest changes git pull —rebase # create your working branch git checkout -b my-new-branch # change files # add your changed/new files git add my-file.scss # as an example # add a commit message git commit -m 'what I changed here and why' # push your new branch to repository git push origin my-new-branch
You should NEVER commit master branch into your branch. If you need to do this, then you did something wrong. Rebase is safe and should add your changes above master changes.
Now you can go on github and create a Pull Request
If you and somebody else changed the same line in a file then you may have a git conflict. If this happens you should run these commands to solve the conflicts:
# you are on your branch here. Make sure you have no changes uncommited # go to master branch git checkout master # make sure you have the latest changes from master branch git pull --rebase # switch back to your branch git checkout my-new-branch # rebase your branch against master branch git rebase -i master # here you'll have to follow screen instructions. This is not an easy step if you're doing this fist time # Force push your fixed branch to github repository git push -f origin my-new-branch
During rebase process you have options to:
# abort rebase git rebase --abort # continue rebase after you solved the conflicts git rebase --continue