User Tools

Site Tools


project_management:git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
project_management:git [2010/08/20 17:44]
aorth
— (current)
Line 1: Line 1:
-====== git ====== 
  
-git is a distributed version control system originally written by Linus Torvalds.  The version control metadata is distributed, so every clone is a complete history of the source code.  Compare this with centralized systems like SVN or CVS where, if the central repository burns down, everything is lost! 
- 
-  * Official homepage: http://git-scm.com 
-  * Pro Git book: http://progit.org/book 
-  * Cheat sheet: http://cheat.errtheblog.com/s/git 
-  * git ready: http://www.gitready.com 
- 
-====== Installing git ====== 
- 
-====== Migrating from SVN ====== 
-  * Reference: http://www.jonmaddox.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/ 
- 
-===== Install git-svn ===== 
-<code># aptitude install git-svn</code> 
- 
-===== Create a temp git repo ===== 
-This is where we will initially copy the SVN repository. 
- 
-<code>$ mkdir beca_lims_portal_temp 
-$ cd beca_lims_portal_temp</code> 
- 
-==== Initialize temp git repo ==== 
- 
-<code>$ git svn init https://172.26.17.2/svn/beca_lims_portal/trunk/ --no-metadata</code> 
- 
-===== Map SVN users to git ===== 
- 
-==== Create an authors file ==== 
-///home/aorth/svnauthors//: 
-<file>mnorling = Martin Norling <m.norling@cgiar.org> 
-aorth = Alan Orth <a.orth@cgiar.org> 
-root = Alan Orth <a.orth@cgiar.org> 
-akihara = Absolomon Kihara <a.kihara@cgiar.org></file> 
- 
-==== Tell git about your authors ==== 
-<code>$ git config svn.authorsfile ~/svnauthors</code> 
- 
-===== Populate the temp git repo ===== 
-<code>$ git svn fetch</code> 
- 
-===== Clone from the temp repo ===== 
-When doing a normal git clone it will take everything we want from the temporary repository, while leaving behind all the SVN cruft that was there to support the git-svn  stuff. 
- 
-<code>$ cd .. 
-$ git clone beca_lims_portal_temp beca_lims_portal</code> 
- 
-===== See the commit history ===== 
-You should see all your authors mapped from the SVN repository: 
-<code>$ cd beca_lims_portal 
-$ git log</code> 
-====== Tagging ====== 
-Git uses two main types of tags: lightweight and annotated. A lightweight tag is very much like a branch that doesn’t change — it’s just a pointer to a specific commit. Annotated tags, however, are stored as full objects in the Git database. They’re checksummed; contain the tagger name, e-mail, and date; have a tagging message; and can be signed and verified with GNU Privacy Guard (GPG). It’s generally recommended that you create annotated tags so you can have all this information; but if you want a temporary tag or for some reason don’t want to keep the other information, lightweight tags are available too. 
- 
-<note>Without arguments, ''git tag'' creates a "lightweight" tag that is basically a branch that never moves. Normally, you want to at least pass the ''-a'' option to create an unsigned tag.</note> 
- 
-See: 
-  * http://progit.org/book/ch2-6.html 
-  * http://www.gitready.com/beginner/2009/02/03/tagging.html 
- 
-===== Tagging the current version ===== 
-<code>git tag -a v0.2</code> 
-===== Tagging a past version ===== 
-Specify a certain commit by giving the commit's checksum (or the abbreviated checksum): 
-<code>git tag -a v0.1 8e11e65</code> 
- 
-===== Pushing tags to origin ===== 
-By default ''git push'' doesn't send tags to the remote origin; you have to tell it to do it manually. 
- 
-==== Certain tag ==== 
-<code>$ git push origin v0.1</code> 
- 
-==== All tags ==== 
-Push all tags which are not already on the remote origin: 
-<code>$ git push origin --tags</code> 
- 
-==== Reverting a file to a particular revision ==== 
-If you want to revert a file in the current working revision to a past revision 
-<code>$git checkout <commit_hash> filename</code> 
- 
-====== Tips ====== 
- 
-===== Edit a commit ===== 
-To edit a commit (like fixing a spelling or logic mistake): 
-  - Look at ''git log'' and copy the first 5 or so characters from the ID of the commit you want to edit onto your clipboard. 
-  - Start the interactive rebase process, pasting in the characters from the ID: <pre>git rebase --interactive ID</pre> 
-  - Your editor will come up with several lines like ''pick d3adb33 Commit message'', one line for each commit since the older one. 
-  - Change the word "pick" to "edit" in front of the commit you want to change. 
-  - Save and quit. 
-  - Edit your project files to make the correction, then run ''git commit --all --amend'' 
-  - After you’ve committed the fixed version, do ''git rebase --continue'' 
- 
-===== Assume file unchanged ===== 
-Certain files, like database configuration files, need to be tracked but you don't want to push changes to the remote repo.  This is different than using a ''.gitignore'' file, as //those files are not tracked in the repository// This allows you to have a generic database config in your repository without telling everyone your database password! 
- 
-See: http://justaddwater.dk/2009/12/07/how-to-make-git-ignore-files-that-already-exist-in-your-project/ 
- 
-<code>$ git update-index --assume-unchanged common/config</code> 
- 
-===== Assume file changed ===== 
-The opposite of the above: 
-<code>$ git update-index --no-assume-unchanged common/config</code> 
- 
-====== Configuration ====== 
- 
-===== ~/.gitconfig ===== 
- 
-==== Set a default editor ==== 
-The editor is used when you have to enter a commit message. 
-<file>[core] 
-    editor = vim</file> 
-==== Colorize git output ==== 
-<file>[color] 
-    ui = auto 
-[color "branch"] 
-    current = yellow reverse 
-    local = yellow 
-    remote = green 
-[color "diff"] 
-    meta = yellow bold 
-    frag = magenta bold 
-    old = red bold 
-    new = green bold 
-[color "status"] 
-    added = yellow 
-    changed = green 
-    untracked = cyan</file> 
-     
- ==== Check the current git configurations ==== 
-<file>git config -l</file> 
project_management/git.1282326292.txt.gz · Last modified: 2010/08/20 17:44 by aorth