-
Branch off from main branch,
masterordevelop, whichever the team decides. For this guide, let's use themasterbranch.- new feature -
feature/<feature-desc> - bug fix -
bugfix/<issue #>-<fix-desc> - hot fix -
hotfix/<version> - release -
release/<version>
git checkout -b feature/new-feature - new feature -
-
Rebase often to keep code in-sync
git fetch git rebase origin/master -
When ready, push branch to remote
git push -u origin feature/new-feature -
Create a pull request (https://goo.gl/qXJ4s4)
-
Once merged to master, delete feature branch on local
Visual Diagram - https://guides.github.com/pdfs/githubflow-online.pdf
-
Branch off a point in master
git checkout -b release/1.0.0 -
Once ready, tag top of branch to create new release and merge into
mastergit tag 1.0.0 git checkout master git merge release/1.0.0 -
Push to
origin/masterincluding the taggit push origin master --tags -
Delete
releasebranchgit branch -d <branch_name> -
Add release notes (you can also do this in the repo e.g. bitbucket)
-
Branch off from release tag that you want to fix
git checkout 1.0.0 git checkout hotfix/2.0.1 -
Commit hot fix
-
Once ready, tag top of branch e.g.
2.0.1to create new release and merge into master -
Delete hotfix branch
-
add release notes (you can also do this in the repo e.g. bitbucket)
A "stale" pull request is one that is no longer up to date with the main line of development e.g. master branch, and it needs to be updated before it can be merged into the project.
The most common reason why pull requests go stale is due to conflicts: if two pull requests both modify similar lines in the same file, and one pull request gets merged, the unmerged pull request will now have a conflict.
Sometimes, a pull request can go stale without conflicts: perhaps the branch was created when someone had accidentally merged failing unit tests to the master branch. Regardless of the reason, if your pull request has gone stale, you will need to rebase your branch onto the latest version of the master branch before it can be merged.
-
fetch latest changes in remote and sync local branch w/ remote
git fetch origin git checkout feature/x git pull origin feature/x -
start to rebase feature branch (make sure you are in feature branch)
git rebase -
During this time, you will likely see messages such as conflicts in files. If this happens you need to resolve those conflicts and continue to rebase.
vi file # edit file w/ conflict to resolve git add . # add back file git rebase --continue # continue to rebase
Just a side note, if you are using phpstorm resolving conflicts can be done by right-clicking on the file, hover to "git" and select "resolve conflict"
-
Once done w/ rebasing, push back changes to remote
git push origin feature/x --force -
Proceed w/ the pull request as is