Wiki
Clone wikipleabargains / git
Working with git version control
Branching policy
You can commit fixes to a branch such as dev or any feature branch, but don't commit to master, only merge into master. In general, new features should be created in separate feature branches. Dev and master, as well as feature branches, should be periodically updated with updates that might be in other branches. It should in theory be easier to merge a feature branch into master if the feature branch is periodically updated with any changes from master as they come in.
Updating a feature branch
Adapted from here. * Let's say you want to merge some updates from avatar_customization branch into the branch dev*
First we'll update your local avatar_customization branch. Go to your local project and check out the branch you want to merge from (your local avatar_customization branch)
#!bash
$ git checkout avatar_customization
Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to avatar_customization will be stored in a local branch, remotes/origin/avatar_customization
#!bash
$ git fetch -p origin
Merge the changes from origin/avatar_customization into your local avatar_customization branch. This brings your avatar_customization branch in sync with the remote repository, without losing your local changes. If your local branch didn't have any unique commits, Git will instead perform a "fast-forward".
#!bash
$ git merge origin/avatar_customization
Check out the branch you want to merge into
#!bash
$ git checkout dev
Merge your (now updated) avatar_customization branch into your feature branch to update it with the latest changes from your team.
#!bash
$ git merge avatar_customization
Depending on your git configuration this may open vim. Enter a commit message, save, and quit vim:
- Press a to enter insert mode and append text following the current cursor position.
- Press the esc key to enter command mode.
- Type :wq to write the file to disk and quit.
This only updates your local feature branch. To update it on GitHub, push your changes.
#!bash
$ git push origin dev
Updated