Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

No Format
git config --global user.name "Joe Example"

user.email must be a working email address. This address should be permanent, ie: not something that will change when you change jobs.

...

No Format
git config --global user.email joe@example.com

Day to day usage

For a quick summary, see the Git homepage.

...

No Format
git clone git://mifos.git.sourceforge.net/gitroot/mifos/REPOSITORY_NAME

Where REPOSITORY_NAME is "head", or any of the repositories listed at http://mifos.git.sf.net/. For instance, to check out the head revision:

...

No Format
ssh://USERNAME@mifos.git.sourceforge.net/gitroot/mifos/head

Where USERNAME is your sf.net username.

...

Add files to the git "index" so they will be committed with "git add". Optionally, instead of running "git add", include -a when running "git commit" to commit all local modifications except new files. Then, commit:

No Format
git commit

In Git, the first 80 characters of the first line are, by convention, a summary of the rest of the log message. See Commit Log Guide.

...

No Format
git push origin master

Update your master branch

No Format
git pull origin master

Creating a patch

Here are two suggestions.

...

No Format
git format-patch

2) If you have a public git repository, create a pull request with

...

No Format
git branch NAME_OF_BRANCH

Deleting a local branch

No Format
git branch -d NAME_OF_BRANCH

List branches

Local branches can be listed with:

No Format
git branch

To see all "remote" branches:

No Format
git branch -a

Note that "remote branch" really means a local copy of a remote branch.

...

No Format
git checkout BRANCH_TO_MERGE_CHANGES_TO
git merge OTHER_BRANCH

More on merging

Again, see Pro Git: Basic Branching and Merging.

...

No Format
git remote add 1.5.x ssh://USERNAME@mifos.git.sourceforge.net/gitroot/mifos/1.5.x

Then you mirror the branch "master" from the remote repository "1.5.x", pull in a change, and push it back up to "head":

No Format
git fetch 1.5.x
git cherry-pick 5948a92795197bc4e6577173445d0efac09130ae
git push origin master

Resolving merge conflicts

...

No Format
git tag -s 1.5.0 f32b705f09b879bc91324f31cbcbff87637d9fb3
git push --tags origin

Builds

Hudson automatically tags commits as they are built. These are currently only stored locally in Hudson's clones. It might be convenient to automatically propagate these tags elsewhere.

...

No Format
mkdir mifos-1.5.x && cd mifos-1.5.x
git svn init https://mifos.svn.sourceforge.net/svnroot/mifos/branches/v1.5.x
git svn fetch

This will take a while. While this is running, create a new git repository at sf net for the branch you are about to copy from Subversion.

...

No Format
git remote add origin ssh://meonkeys@mifos.git.sourceforge.net/gitroot/mifos/1.5.x
git push origin master

Mid-migration maintenance

...

No Format
git svn fetch
git merge remotes/git-svn
git push origin master

To move your changes past all svn changes in your local git-svn clone, do:

No Format
git svn rebase
git push origin master

If you lose your original git-svn clone of, say, /branches/1.5.x, you can do the following to hook a clone of the 1.5.x repo back up to the corresponding branch in svn:

No Format
git config svn-remote.svn.url https://mifos.svn.sourceforge.net/svnroot/mifos/branches/v1.5.x
git config svn-remote.svn.fetch ':refs/remotes/git-svn'

Then try rebase/push as mentioned above.

...

No Format
#!/bin/bash
set -o errexit

for repodotgit in `\ls $HOME/repositories/mifos`
do
    cd $HOME/repositories/mifos/$repodotgit
    repo=`basename $repodotgit .git`
    git fetch --quiet git://mifos.git.sourceforge.net/gitroot/mifos/$repo > /dev/null
    cd - > /dev/null
done

rsync --archive --delete --relative \
    mifos.git.sourceforge.net::gitroot/mifos/*/config \
    mifos.git.sourceforge.net::gitroot/mifos/*/description \
    mifos.git.sourceforge.net::gitroot/mifos/*/hooks \
    $HOME/extra_git_files

See also: http://kerneltrap.org/mailarchive/git/2010/5/20/30749

...