This repository was archived by the owner on May 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 189
How to Edit Feature Branches
Bryan Masamitsu Parsons edited this page Sep 25, 2018
·
1 revision
This assumes that you are working with an existing feature branch that has already been pushed to the Github GPSTk repo, and for which you have a local tracking branch.
Simple Recipe:
- Fetch all feature branch updates:
git fetch --all - Pull updates from the remote server into your local tracking branch:
git merge origin/issue_99 issue_99 - Checkout the feature branch:
git checkout issue_99 - Make changes:
echo "Hello World" > README.txt - Add changes:
git add README.txt - Commit changes:
git commit -m "Did stuff that fixes issue_99" - Update master branch:
git checkout master; git pull - Merge updates from master into feature branch:
git merge master issue_99 - Push feature branch updates to remote server:
git push origin issue_99
Detailed Recipe:
- Fetch all updates to the feature branch
git fetch --all- Alternatively, if you really want to only fetch a single feature branch
git fetch origin issue_99:refs/remotes/origin/issue_99
- If another developer is actively working on the feature branch, you may need to pull updates to the feature branch before merging with master:
git checkout issue_99git merge origin/issue_99 issue_99
- Once you are sure the feature branch is up to date, make changes to the branch and commit them
git checkout issue_99git commit -m "Did stuff that fixes issue_99"
- Once you're ready to prepare for merging with master, pull the latest updates to master branch, and merge onto the feature branch, resolving any resulting merge conflicts
git checkout mastergit pull origin mastergit checkout issue_99git merge master issue_99- This last step adds a new commit object on the end of feature branch
issue_99without changing themasterbranch. The order of the branch names is important!
- What about using
git rebaseinstead ofgit merge?- It is far too easy to screw things up if you rebase on a "public" branch, i.e. one visible to others
- Please follow the "Golden Rule of Rebasing": never rebase a branch that you've already pushed
- Push the updated feature branch to the remote on the Github GPSTk repo:
git push origin issue_99