Typical Git workflow
Clone this wiki locally
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.
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
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
Finally, create the patch. A file with the name derived from the commit message will be created:
git format-patch origin