Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
## When you begin working on a feature
Step 1: Update the main (demo) branch
git checkout demo
git pull origin demo
Step 2: Create a feature branch off of the main branch (demo)
git checkout -b my_feature_branch demo
Step 3: Record/Commit your work
Step 4: Keep rebasing your feature branch off the main branch
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 demo
git pull origin demo
git checkout my_feature_branch
git rebase demo
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.
Step 5: You are done
Now you are ready to merge in your changes into the mainline (`demo` branch). Repeat step 4 -- to ensure you have all of the mainline code.
Then do:
git checkout demo
git merge --no-ff my_feature_branch
git push origin demo
If the `push` fails do `git reset --hard origin/demo` and then repeat Steps 4 and 5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.