git checkout master
git pull origin master
git checkout -b my_feature_branch master
... make some code changes ...
git commit -m 'my work' (This is an example - **don't copy paste this**)
This will ensure that your feature branch is up-to-date with the main branch and has all of it's code
git stash
git checkout master
git pull origin master
git checkout my_feature_branch
git rebase master
git stash pop
When you are doing the rebase, you may run into merge conflicts. Don't get spooked by merge conflicts. Resolve, them one-by-one and then run git rebase --continue
after resolving each merge conflict.
Now you are ready to merge in your changes into the mainline (master
branch). Repeat step 4 -- to ensure you have all of the mainline code.
Then do:
git checkout master
git merge --no-ff my_feature_branch
git push origin master
If the push
fails do git reset --hard origin/master
and then repeat Steps 4 and 5.