Git Guide for TideSDK Devs - gladenko/TideSDK GitHub Wiki

Setup git

  • Install git on your system
  • Initialize so your commit messages will appear in the repos your work on

To initialize:

git config --global user.name "your name goes here"
git config --global user.email "your email address here"

Work Flow

Our goal in the project is to adhere to a workflow to keep the project well organized. We have adopted the Successful Git Branching Model for managing our repositories and work flow. This ensures that virtually all work is done in feature/hotfix branches (or forks), then merged into the develop branch, then into master.

As a general rule, you should clean up your commits before pushing and merging, and do not touch other peoples work. For example, if you have 3 commits for changing a single readme file, squash them into one before pushing.

Basic operations

The basic operations for git are creating, branching to work on a feature or a fix, merging to master if changes accepted, and removing the branch. If a repo is already created, you skip first step and simply clone it.

Create a repo

On your github:

  • create repo
  • check with README
  • select none on .gitignore

Check out repo

If a repo already exists, simple clone it onto your system

On your github:

  • copy ssh address (on linux/macos)
  • copy https address (on windows)

On your console:

Navigate to where you want the repo on your system.

  • On MacOS/Linux:
git clone [email protected]:TideSDK/TideSDK.git
  • On Windows:
git clone https://github.com/TideSDK/TideSDK.git

Create a local branch

With a clone on your system, to create a new feature or work on a fix, it is best to do it in a branch then if changes accepted, merge to master. Here we create a local branch:

git branch my_fix

To see the branches in the repo:

git branch -a

To work with the branch:

git checkout my_fix

To commit changes is straight forward:

git commit -a -m 'my commit message'

To be able to push and sync new local brach to our remote github repo

git push origin my_fix

Checking out a remote branch

Sometimes a branch already exists that perhaps another developer has already made and all we want to do is check it out and work on it. So you would clone the repo first to your system if not already there, then

git checkout -b my_fix origin/my_fix

Merge branch

When changes are accepted to the repo and time to merge to master, just to a git merge. If there are no conficts, it will just work.

First switch to master:

git checkout master

Then merge and commit:

git checkout master
git merge my_fix
git push

Delete remote branch

Once we are done with a branch, we may delete it. Sometimes the work in a branch is not accepted so in those cases it should stay until a decision is made on it. To remove a remote branch:

git push origin --delete my_fix

Delete local branch

git branch -d my_fix

Tagging a Release

Tagging a release is as simple as making a commit:

git tag -a 1.2.0.RC6e -m 'end of line for titanium desktop - last appcelerator release'

To push the tag to the remote repository:

git push origin --tags

References

The above are operations you will perform routinely. For more detailed information about git consult:

Copyright and Attribution

The following copyright and attribution applies to this document:

Copyright © 2012 David Pratt (for TideSDK). All rights reserved.

CONTRIBUTORS:

  • David Pratt
  • Francisco Zarate
  • Steven Verbeek