Skip to content
This repository was archived by the owner on Nov 18, 2021. It is now read-only.

Typical Git workflow

j416 edited this page Sep 13, 2010 · 10 revisions

Download and install Git

In Linux distributions thatโ€™s usually just yum install git or
apt-get install git. See GitHub
guides
if youโ€™re on Windows or Mac.

Cloning repository

Go to the folder which will contain the clone, then type:


git clone git://github.com/bard/sameplace.git

Create your own local branch

Creating a local branch lets you make changes, compare with main
branch, and generate patches.

To create the branch:


git branch fix_for_foobar

To switch to it:


git checkout fix_for_foobar

Making changes

When youโ€™re satisfied with the changes, youโ€™ll want to commit them to
your local branch. Keep in mind that, differently than SVN or CVS,
โ€œcommittingโ€ doesnโ€™t mean copying stuff from your working copy to the
central repository, instead youโ€™ll be copying stuff from your working
copy to a branch in your local repository. Weโ€™ll see later how to get
that into the remote repository too.

To commit changes to local branch:


git commit -a -m 'Join Room Dialog: foobar functionality was broken.  Fixed.'

Preparing the patch

First, youโ€™ll want to make sure that youโ€™ll be producing a patch
against the most recent version of the central repository, so switch
to the master branch and update it:


git checkout master
git pull

Next, tell git to apply your local commits on top of the renewed master:


git rebase fix_for_foobar

Hint to author: The above will rebase master on top of fix_for_foobar, not the other way round.

Finally, create the patch. A file with the name derived from the commit message will be created:


git format-patch origin

Clone this wiki locally