Wiki

Clone wiki

ufo / develop / UsingGit

Starting out with git

For git reference, see Pro Git book.

Useful Aliases

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.last 'log -1 HEAD'

Fork UFO Repository

Use bitbucket's fork option to create a fork of the repository. This gives you an ability to create pull request through bitbucket

Clone

Create a local copy of the repository:

$ git clone git@bitbucket.org:USERNAME/REPOSITORY

Add arieg/ufo as a remote to your repository

$ git remote add blessed git@bitbucket.org:arieg/ufo.git

Get updates from blessed repository

Do this every time to get updates from the main repository. This is a partial equivalent to svn update:

$ git fetch blessed

Merge new changes into your master branch

This is the second part of svn update. Not all of these commands are strictly necessary. Read the manual for details. The steps are: switch to a master branch, merge new changes into it, and save results on bitbucket fork of the repository.

$ git checkout master
$ git merge blessed/master
$ git push

Branch

To do any new work start a branch. Think of a branch as a name of a patch that will eventually contain all your changes. Branches can be short lived. You don't have to use unique names. But, meaningful branch names are easier to handle.

$ git checkout master
$ git checkout -b develop1

Saving a branch

To store a branch in bitbucket fork, do:

$ git push origin develop1

Deleting branches

There is special command to delete local branches. Remote branches are deleted by pushing nothing into them:

# delete local branch
$ git branch -d develop1
# delete remote branch
$ git push origin :develop1

Rebasing a branch

You get new blessed changes while working on a branch by rebasing the branch on the new master. First, fetch changes from blessed/master and merge them into your master as described above. Then,

$ git checkout develop1
$ git rebase master

This is more-or-less the same as doing svn up to get someones changes into your current workspace.

Submitting changes

After you are done with a portion that makes a good patch, rebase your branch against the latest master and submit a pull request. This can be done by email, a git command, or using bitbucket interface. Use whichever you like.

Starting over again

After your change has been accepted, update your master, possibly delete the old branch, rebase (or start a new branch) from the new master.

Updated