Differences between revisions 2 and 3
Revision 2 as of 2012-10-21 14:27:05
Size: 1750
Editor: nwellnhof
Comment:
Revision 3 as of 2012-11-02 21:41:55
Size: 1690
Editor: nwellnhof
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Git setup = = Git cheat sheet =

=
= Git setup ==
Line 34: Line 36:
= Cloning = == Cloning ==
Line 36: Line 38:
To clone a repository: To clone the repository:
Line 39: Line 41:
# Non Committers
git clone http://git-wip-us.apache.org/repos/asf/lucy.git

# Committers
Line 46: Line 44:
= Standard workflow = == Standard workflow ==
Line 56: Line 54:
= Working with branches = == Working with branches ==

Git cheat sheet

Git setup

If you're a first time Git user, set up your global Git configuration first:

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

Enabling color output is highly recommended:

git config --global color.ui auto

You can also create your own global .gitignore file in $HOME, and put rules for your editor temp files in there. Enable it like this:

git config --global core.excludesfile ~/.gitignore

By default, 'git push' without arguments pushes all local branches to existing branches with the same name on the remote. This is not what most users expect. It is recommended to change the 'push.default' setting to 'upstream', so only the current branch will be pushed to its upstream branch.

git config --global push.default upstream

ASF committers can set their Apache username, so they don't have to enter it with every commit:

git config credential.username <username>

Cloning

To clone the repository:

git clone https://git-wip-us.apache.org/repos/asf/lucy.git

Standard workflow

git checkout <branch>
git pull --rebase
[edit]
git commit
git push

Working with branches

Create and switch to a local branch:

git checkout -b <branch>

Push local branch to remote for the first time:

git push -u origin <branch>

Use the -u option to automatically setup the remote tracking configuration.

Checkout a remote tracking branch:

git checkout --track origin/<branch>

Delete a remote branch:

git push origin :<branch>

GitCheatSheet (last edited 2012-11-02 21:41:55 by nwellnhof)