...
There is a variety of good information about Git available online, including:
- The official Git documentation, which includes both a tutorial and a complete reference manual with links to individual subcommand documentation.
- Pro Git is an excellent free online book.
Getting Started
Getting help
...
You can also use git diff to see the changes between arbitrary revisions of your project:
- Changes in working copy vs. previous commit:
Code Block git diff <commit>
-Changes between two previous commits:
...
To resolve the conflict manually:
- Edit the conflicting files as necessary.
To discard your changes (and accept the remote repository version):
- run
git checkout --theirs README
To override the repository with your changes:
- run
git checkout --ours README
When you complete the above tasks:
- add the files with
git add
- commit the changes with
git commit
.
Log, Tags, and Branches
Viewing history
...
Git has explicit support for tagging and branching.
git tag
manipulates tagsgit branch
andgit checkout
manipulate branches
Tags
Create a tag:
Code Block |
---|
$ git tag [-a] TAGNAME |
...
Git is not really just like Subversion (or most other version control solutions). That's mainly because of the git "index".
- The index is a staging area between your working copy and your local repository.
git add
adds files to the indexgit commit
commits files from the index to the repository.
The diff commands uses the index:
git diff
is the difference between your working copy and the index.git diff HEAD
is the difference between your working copy and the local repository.git diff --cached
is the difference between the index and the local repository.
Refer back to this illustration if you get confused:
...
Git can integrate with other version control systems.
- It can act as a Subversion client (may be the only Subversion client you ever need).
- Can import a CVS repository.
Integrating w/ Subversion
...
Code Block |
---|
$ export CVSHOME=:pserver:anonymous@example.com $ cvs login $ git cvsimport -o cvs_head -C my-project |
Git Frontends
The git wiki has a list of frontends for git.