- Official Git Book (Pro Git), reference book.
- Pragmatic Guide to Git, easy-going introduction, not too difficult.
- Mastering Git, more advanced.
- Try Git, simple and nice intro to the basics of the git command line.
- Learn Git Branching, similar to Try Git but with a focus on "branching" and more advanced ops.
- gitk, git-gui, prepackaged with
git
- GitHub Desktop, MacOS, Windows, (no Linux support). Barebones git.
- GitKraken, MacOS, Windows, Linux. More complete in terms of features.
- Embedded in your text editor (via plugins, etc.):
- Sublime Text: GitSavvy, text based interface to git. Quite complete.
- Sublime Text: Git, access to git through an embedded command line. Very thin wrapper.
- Magit for Emacs, extremely handy - if you use Emacs :-).
- All VCS-tracked files in your project plus the full history of changes (commits) and branches.
- Any folder with a valid
/.git
subfolder in charge of tracking changes to not.gitignore
d files in the folder. - A repository can also be stored remotedly (handy in cases of projects with multiple collaborators).
Other repository-related concepts are:
- Clone: Your personal, local copy of a project (including a pointer to the remote repository -
origin
)- Origin: A standard alias (a name) that references the remote repository from which yours is a clone.
- Fork (GitHub-only): Your remote copy (stored in GitHub) of a project. A local copy of a fork will include a reference to the remote copy (
origin
), as well as a reference to the source project (upstream
)- Upstream: A standard alias (a name) that references the remote repository from which yours is a fork.
This diagram, taken from StackOverflow might help you understanding the clone/fork story:
- Current local view of the project (folder). It can be changed by switching back to a previous state of the project (reset), a parallel state of the project (branch), or a future state (e.g. pulling from a remote repository).
- A human-readable pointer to a particular commit. There are several types: Heads, Tags, Remotes.
- Head
- A pointer to the current state of the working-tree.
- A dynamic symbolic reference (a reference of a reference, instead of a SHA-1 value) to the current branch.
- Tags
- A name to a particular state in the repository's history.
- A static symbolic reference to a commit. It contains a tagger, a date, a message and a pointer.
- There are two types, "annotated tags" and "lightweight tags":
- Annotated
- Lightweight
- Remote
- A repository copy stored in a remote server to which the local respository copy has access to (read or write, or both).
- A reference (or a bookmark) to a commit on a remote repository. It is read-only in the sense that it doesn't get updated by local commits.
- A snapshot of the entire working directory (plus metadata including references to a previous snapshot, unique identifier - hash -, author, date etc.).
- A reference to a commit object (a log of all changes from a previous/parent commit to the current). It is referenced by a SHA-1 value and it is always associated with a branch.
- Any of the parallel states in the repository (a particular commit history).
- A dynamic symbolic reference (a reference to a reference) to a commit. It gets updated after every new commit operation.
See Cheatsheets for the moment.
A .gitignore
file in the top directory of your project tells git to ignore files that match the expression in it.
- Example file:
*~ # ignore emacs wip files .* # ignore hidden files /build # ignore /build dir (and everything in it)
- Ignore /doc directory, but include tree rooted at /doc/img
/doc/*
!/doc/img
git config --global user.name "My Name"
git config --global user.email "[email protected]"
git config --global core.editor /usr/bin/emacs
TODO
TODO
- You can have a personal homepage served by GitHub. See instructions here:
- Make sure that your project complies with the structure of a static homepage.
- Set your repository name to
username.github.io
-
Create a tag for the commit you want a downloadable (and push it)
git tag v0.0 git push origin v0.0
-
Your zip file is now accessible from
https://www.github.com/username/repo/archive/v0.0.zip
-
Your tarball is now accessible from
https://www.github.com/username/repo/tarball/v0.0