Difference between revisions of "Git"
(→See also: Duplicate a Git repository) |
(useful git commands) |
||
Line 12: | Line 12: | ||
If a repository is cloned, git tracks the '''master''' which is the latest commit on the remote repository, as well as the '''origin/master''' which is the last '''known''' commit from the source sourced repository. This is updated if your remote changes are pushed back to the repository you cloned from. | If a repository is cloned, git tracks the '''master''' which is the latest commit on the remote repository, as well as the '''origin/master''' which is the last '''known''' commit from the source sourced repository. This is updated if your remote changes are pushed back to the repository you cloned from. | ||
− | |||
− | |||
== Using Git to update Wikimedia extensions == | == Using Git to update Wikimedia extensions == | ||
Line 21: | Line 19: | ||
{{code|<pre>git checkout 6854b712f200a833220c156a2499f502317c20c1</pre>}} | {{code|<pre>git checkout 6854b712f200a833220c156a2499f502317c20c1</pre>}} | ||
− | == | + | == Reverting a working copy == |
− | + | {{code|<bash>git reset --hard <branch/tag/rev></bash>}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | {{code|<bash> | ||
− | git reset --hard | ||
− | |||
− | </ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </bash>}} | ||
− | |||
− | {{code|<bash> | + | == Updating just a single file == |
− | + | {{code|<bash>git fetch</bash>}} | |
− | |||
− | + | followed by | |
− | |||
− | |||
− | + | {{code|<bash>git checkout origin/master -- path/to/file</bash>}} | |
− | |||
− | {{code|<bash> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </bash>}} | ||
== Links to Setting up Git Servers == | == Links to Setting up Git Servers == |
Revision as of 18:01, 5 March 2015
Git is a distributed revision control / software code management project created by Linus Torvalds, initially for the Linux kernel development.
Git's design was inspired by BitKeeper and Monotone. Git was originally designed only as a low-level engine that others could use to write front ends such as Cogito or StGIT. However, the core Git project has since become a complete revision control system that is usable directly. Several high-profile software projects now use Git for revision control, most notably the Linux kernel, X.org Server, One Laptop per Child (OLPC) core development, and the Ruby on Rails web framework.
Git differs from systems such as CVS, or SVN in that the database is maintained beside the working filesystem on peers. Each peer is easily sync'ed to any other by using push/pull or fetch. In subversion you use three main directory structures;
- trunk
- branch
- tag
In git the trunk is equivalent to HEAD, and is a sha1sum to the latest commit. Branches are used to fork development from the HEAD if for example bug fixing is required. A tag in git is just a named sha1sum commit which is effectilvely a static reference to a particular snapshot of code.
If a repository is cloned, git tracks the master which is the latest commit on the remote repository, as well as the origin/master which is the last known commit from the source sourced repository. This is updated if your remote changes are pushed back to the repository you cloned from.
Contents
Using Git to update Wikimedia extensions
This clones the entire repo including all revisions to your local system. To change the local directory structure to a specific revision, use checkout with the required commit hash, e.g.
Reverting a working copy
Updating just a single file
followed by
Links to Setting up Git Servers
- Set up a bare Git server
- Get up a Gitolite server
- Set up a Gitosis server
- How to set up your own private Git server on Linux. Contains a comparison between Gitolite and Gitosis. This author, having tried both, has a preference for Gitolite.
See also
- 11 July 2013 - our news item about setting up our GitHub mirror
- ProGit.org - everything you wanted to know about using git.
- Debianize Github Projects And Upload to Ubuntu PPA
- Stop Using Git! (ironic) by Matthew McCullough
- Duplicate a Git repository
- Decentralised
- Software