Bureaucrats, cc_docs_admin, cc_staff
2,318
edits
No edit summary |
(Marked this version for translation) |
||
Line 1: | Line 1: | ||
<languages /> | <languages /> | ||
<translate> | <translate> | ||
== Description == | == Description == <!--T:1--> | ||
[https://en.wikipedia.org/wiki/Git Git] is a distributed, fast and secure source code management tool. The official Git website is [http://gitscm.org gitscm.org]. The Git software was initially created by [http://en.wikipedia.org/wiki/Linus_Torvalds Linus Torvalds] for the Linux project and the current maintainer is [http://en.wikipedia.org/wiki/Junio_Hamano Junio Hamano]. The development of Git itself is performed on the [https://git.wiki.kernel.org/index.php/Main_Page kernel.org] platform. | [https://en.wikipedia.org/wiki/Git Git] is a distributed, fast and secure source code management tool. The official Git website is [http://gitscm.org gitscm.org]. The Git software was initially created by [http://en.wikipedia.org/wiki/Linus_Torvalds Linus Torvalds] for the Linux project and the current maintainer is [http://en.wikipedia.org/wiki/Junio_Hamano Junio Hamano]. The development of Git itself is performed on the [https://git.wiki.kernel.org/index.php/Main_Page kernel.org] platform. | ||
== Operating Principle == | == Operating Principle == <!--T:2--> | ||
Contrary to older source code management tools, Git works in a distributed way. This means that developers do not depend on a central repository to commit their changes. Each Git repository contains the full history of the project. Each Git object (changeset, file, directory) is the leaf of a tree with multiple branches. Developing a project with Git is based on a model in which one branch corresponds to one feature. Many revisions of the feature may be archived before the branch gets merged with the main trunk. For a detailed explanation of branch development, we recommend reading [http://nvie.com/posts/a-successful-git-branching-model/ this page]. | Contrary to older source code management tools, Git works in a distributed way. This means that developers do not depend on a central repository to commit their changes. Each Git repository contains the full history of the project. Each Git object (changeset, file, directory) is the leaf of a tree with multiple branches. Developing a project with Git is based on a model in which one branch corresponds to one feature. Many revisions of the feature may be archived before the branch gets merged with the main trunk. For a detailed explanation of branch development, we recommend reading [http://nvie.com/posts/a-successful-git-branching-model/ this page]. | ||
<!--T:3--> | |||
One especially interesting technique is ''cherry-picking'', which is essentially taking part of a branch and merging it with another one. [http://technosophos.com/content/git-cherry-picking-move-small-code-patches-across-branches This page] describes how to use this technique with Git. | One especially interesting technique is ''cherry-picking'', which is essentially taking part of a branch and merging it with another one. [http://technosophos.com/content/git-cherry-picking-move-small-code-patches-across-branches This page] describes how to use this technique with Git. | ||
== Basic usage == | == Basic usage == <!--T:4--> | ||
Generally, a project developer must be able to: | Generally, a project developer must be able to: | ||
<!--T:5--> | |||
# clone or create the repository; | # clone or create the repository; | ||
# make changes; | # make changes; | ||
Line 17: | Line 19: | ||
# push changes toward the original repository. | # push changes toward the original repository. | ||
<!--T:6--> | |||
Since Git is distributed, there may not be an authoritative repository. | Since Git is distributed, there may not be an authoritative repository. | ||
== Summary of commands == | == Summary of commands == <!--T:7--> | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ Basic commands | |+ Basic commands | ||
Line 57: | Line 60: | ||
<!--T:8--> | |||
{| class="wikitable" | {| class="wikitable" | ||
|+ Commands to explore changes | |+ Commands to explore changes | ||
Line 82: | Line 86: | ||
<!--T:9--> | |||
{| class="wikitable" | {| class="wikitable" | ||
|+ Commands for branches, tags and remote repositories | |+ Commands for branches, tags and remote repositories | ||
Line 104: | Line 109: | ||
<!--T:10--> | |||
{| class="wikitable" | {| class="wikitable" | ||
|+ Commands for patches | |+ Commands for patches | ||
Line 120: | Line 126: | ||
<!--T:11--> | |||
{| class="wikitable" | {| class="wikitable" | ||
|+ Other commands | |+ Other commands | ||
Line 138: | Line 145: | ||
|} | |} | ||
== Creating or cloning a repository == | == Creating or cloning a repository == <!--T:12--> | ||
The first step usually is to create your own repository, or to clone an existing one. | The first step usually is to create your own repository, or to clone an existing one. | ||
<!--T:13--> | |||
To create a repository: | To create a repository: | ||
{{Command| git init my-project}} | {{Command| git init my-project}} | ||
<!--T:14--> | |||
To clone a repository: | To clone a repository: | ||
{{Command | git clone git://github.com/git/git.git}} | {{Command | git clone git://github.com/git/git.git}} | ||
== Commiting a change == | == Commiting a change == <!--T:15--> | ||
When the repository is ready, you change directory and edit the file | When the repository is ready, you change directory and edit the file | ||
{{Commands | {{Commands | ||
Line 154: | Line 163: | ||
}} | }} | ||
<!--T:16--> | |||
When work is done, you add the file: | When work is done, you add the file: | ||
{{Command| git add file.txt}} | {{Command| git add file.txt}} | ||
Line 159: | Line 169: | ||
{{Command| git commit }} | {{Command| git commit }} | ||
<!--T:17--> | |||
It is then possible to push changes to the origin repository with: | It is then possible to push changes to the origin repository with: | ||
{{Command| git push origin master}} | {{Command| git push origin master}} | ||
<!--T:18--> | |||
In the above command, ''origin'' is the remote repository and ''master'' is the current branch that will be pushed. | In the above command, ''origin'' is the remote repository and ''master'' is the current branch that will be pushed. | ||
== Hosting Git repositories == | == Hosting Git repositories == <!--T:19--> | ||
[http://github.com GitHub] and [http://bitbucket.org Bitbucket] are two of the main Git repository hosting services. They are both available for commercial projects as well as free projects. | [http://github.com GitHub] and [http://bitbucket.org Bitbucket] are two of the main Git repository hosting services. They are both available for commercial projects as well as free projects. | ||
</translate> | </translate> |