Git Hub Standard and Guide - Thoolium/holoBender GitHub Wiki
General Upload Procedure:
Make sure your feature branch is updated on a regular basis. You should be pulling from the master each time there is a agreed upon push to master to ensure your branch stats up to date.
Pushing to your own branch should be done on a regular basis as well to ensure no progress is lost. Each time you change code without causing bugs, push the changes to your own branch.
Pushing to the master is a team task. If you want to push to the master, at least 2 other team members should be consulted and be in agreement that the code is ready to push to master.
Creating a branch: Each time you finish a feature, it should be pushed to master and any additional features should be worked on on a new branch to avoid a backlog of changes building up on a single branch.
Some Useful commands
commiting changes.
git commit -m "message"
Commits should be complete when you are ready to save a change in your code. Commits will allow you to roll back code even if you haven't pushed these commits to origin yet. Therefore, you should make a commit before making a dramatic change to working code.
For the message, we will use key words. ie "feat - 'small description of feature' " "bug - 'what bug did you fix?'" "docs - 'what did you change'" ** use for changes to documentation ie comments] "style" -- for changes to the style of the code ie formatting, missing semi colons etc
To commit and push to a branch
git status git add -A git commit -m "message" git push orgin [branchName]
This code will check if there are any changes to commit, add all of the changes to the commit, commit all of the changes with your message, and push these changes to the branch. Up until the push origin command all changes are only local to your device.
Creating a new branch
git checkout -b feature_name master git push origin feature_name
The first line will create a feature branch local to your device. The second line will add the branch to the GitHub.
Reverting to a previous commit
git add -A git commit -m "make a temporary commit before reverting" git log --oneline git reset --hard [hash here]
The first two lines are what you would do when commiting normally. If you would like to revert to a commit that has not been pushed yet follow the second two lines. The hash will appear when you type the git log line and will look something like this: ale8fb5.
Pushing features to master
git pull origin master git checkout master git merge --no-ff feature_name git push origin master git push origin :feature_name
The first line merges the master into your local branch to ensure you are up to date. The second line takes you to the master branch, the third line merges your branch to master (local) and preserves history. The fourth line will push the merge to the GitHub. The last line will delete your branch from GitHub.