View the Most Wanted LQ Wiki articles.
LinuxQuestions.org > Linux Wiki > Using git

From LQWiki

Jump to: navigation, search

To use git, a version of git is required. To obtain git - or know what it does - see git. In this document, some basic commands of git will be discussed.

In a console, 'cd' to the folder where you want the development version of your desired project. You'll need an address (git://git.address.with/path/to/desired/project.git) to obtian the development version of your desired project. To obtain the linux kernel (+/-150MB) for example, type:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git;

A subdirectory will be created for your project to contain the source files. To upgrade your project later 'cd' to this created directory and type:

git pull origin;

Editing code

You can change your code using your favorite editor, To see the changes:

git diff

To undo changes, type:

git checkout -f

You can also create branches to make distinct changes. To list the branches, type:

git branch

The 'master' branch is the root of the source. To create a new branch for your own modifications, type:

git checkout -b BRANCH_NAME master

To change the current branch to another, type:

git checkout BRANCH_NAME

See also

git

External links

http://git.or.cz/


Personal tools