RedbirdHacks official website: http://redbirdhacks.org
-
Ensure you are on master
git checkout master
-
Create and switch to a new branch (name it after what the feature is about, examples: fix-auth-bug, add-navbar, refactor-user-model)
git checkout -b your-branch-name
-
Do your work for this feature on this branch.
Notes:
- Make sure to keep all work done on this branch related to the feature. If you need to work on something else, like another bugfix or feature, create a new branch! It makes it easier to manage changes.
- If you want to backup your work, you can push your branch to the server. THe first time, you will have to tell it where:
git push -u origin your-branch-name
. Afterwards, you can justgit push
while on that branch.
There are two options for merging a branch - via pull request or locally.
Choose this if you want someone else to review your changes before you merge
-
Ensure you are on your feature branch
git checkout your-branch-name
-
Push your branch to server
git push origin your-branch-name (or just git push if your upstream is set)
-
Create a pull request via the Github GUI
-
Wait for review, start a discussion if necessary, etc.
- If the review results in you needing to make more changes - simply make them, commit them, and push again. Pushing commits on your feature branch will update the pull request automatically
-
Once your pull request is merged, you can delete your feature branch - it is no longer needed
git branch -d your-branch-name
Choose this if you don't want someone else to review your changes before merge
-
Ensure you are on the master branch
git checkout master
-
Pull down any changes
git pull
-
Merge your branch into master
git merge your-branch-name
-
Resolve any merge conflicts
- Git will do it's best to automatically merge branches
- Any conflicts will be shown to you via
git status
- Fix conflicted files by making them what they should be, i.e. open them in your favorite editor, get rid of the conflicting lines you don't want, and get rid of git's markup
>>>> HEAD
,<<<<
, etc. - Once a file's conflicts are resolved,
git add
it - If you had to manually resolve conflicts, once you are done you must
git commit
the merge
-
Push master up
git push
-
Delete your feature branch - it is no longer needed, the changes on that branch now live in master
git branch -d your-branch-name
ONLY DO THIS WHEN MASTER IS STABLE
-
Ensure you are on production
git checkout production
-
Merge the master branch into the production branch
git merge master
-
There should be no merge conflicts. If there are conflicts, then something is wrong. Find the person who is to blame using the Github GUI and resolve the conflicts.
-
Push the updated production branch to the server
git push origin production // if you have set the upstream, just git push will do
-
Switch back to master
git checkout master