-
Notifications
You must be signed in to change notification settings - Fork 1
Simplified GIT Workflow
Mackenzie edited this page Sep 4, 2018
·
2 revisions
git checkout develop
git pull --rebase origin develop
git checkout -b [your initials]-feature-my-new-feature
- Make commits...
git checkout develop
git pull --rebase origin develop
git checkout feature-my-new-feature
-
git rebase develop
- Solve any conflicts, then
git rebase --continue
until done.
- Solve any conflicts, then
-
git log --oneline
- Copy the commit hash previous to your first commit on the feature.
- Squash your commits:
git rebase -i [paste commit hash]
- You'll see a list of your commits next to the word
pick
- Change all
pick
tos
except the top mostpick
- Save and exit the VIM editor.
- You'll see a list of your commits next to the word
- Create a commit message for your squashed commits
- Remove all lines not beginning with
#
. - Add a commit message at the top of the file (no
#
in front). - Save and exit the VIM editor.
- Remove all lines not beginning with
git push origin feature-my-new-feature
- Locate your feature branch in the Branches tab in your github repo.
- Click Create Pull Request and leave a short description of the feature you finished.
To update your pull request with changes, simply continue making commits in your feature branch.
Do not squash these new commits (Or, you'll end up with conflicts). Instead just push them to github as normal.
- When you branch has been merged, remove your local feature branch
git branch -d local-feature-branch
git checkout develop
git pull --rebase origin develop
If there are conflicts with develop use the following command
-
git checkout . && git reset --hard origin/develop
If not continue to the next step
git checkout feature-my-new-feature
-
git rebase develop
- Solve any conflicts and
git add -A
, thengit rebase --continue
until done.
- Solve any conflicts and
-
git push origin feature-my-new-feature
(If you're unable to push, trygit push -f origin feature-my-new-feature
to force)
Happy Coding! ✌️