create new tag
view all tags

Using git Repositories

This is a very quick guide to using git repositories. It assumes that git is installed and running on your machine. For git information and download, see git homepage . Git is easy to install from source (recommended).

For more detailed information, consult the git man pages, or read the tutorials and howtos on the site given above. Also, run git help -a to see all available git commands.

Known git error:

If you see the following error:

Warning: No merge candidate found because value of config option
"branch.dev.merge" does not match any remote branch fetched. 

in response to git commands, make sure you are running at least version (yum install under SL5.4 installs git . Prior to this version, git failed to add a remote tracking branch to the git config file when creating a local branch from a remote repository, resulting in this error. The latest version that can be installed under SL5.4 without replacing other installed libraries is git 1.5.6.

Quick git Usage

git add .

adds all files in the directory to the git repository

git commit

commits all changes to the git repository

git log

shows the log of commits to the repository

git diff

shows changes between commits, or if outstanding changes have not been committed, shows these changes

git init

creates a git repository in the current directory

git branch

list, create, or delete branches

git status

shows the status of the working tree

git checkout 

switches to a different branch (no branch name defaults to master branch)

Checking out a remote branch, and merging it with a local branch

$ git branch newstuff origin/newstuff
$ git checkout newstuff

Great this new stuff looks pretty interesting, let's merge it back to the local master branch:

$ git checkout master
$ git merge newstuff

Let's push it back to the repo

$ git push origin master

But say we want to push to a different remote branch? First, checkout the remote branch as local, merge the two, push back:

$ git branch dev origin/dev
$ git checkout dev
$ git merge newstuff
$ git push origin dev

-- DuncanPenfoldBrown - 2009-07-23

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | More topic actions
Topic revision: r4 - 2009-12-22 - crlb
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback