Difference between revisions of "Git"

From Jon's Wiki
Line 1: Line 1:
 +
== Handy git configuration ==
 +
 +
Put this in your ~/.gitconfig
 +
 +
[alias]
 +
    lol = log --graph --decorate --oneline
 +
[color]
 +
    diff = auto
 +
    branch = auto
 +
    log = auto
 +
    status = auto
 +
[push]
 +
    default = current
 +
[user]
 +
    name = Harry Potter
 +
    email = harry@hogwarts.school.uk
 +
[core]
 +
    autocrlf = input
 +
    pager = less -F -X
 +
 +
Bung these in your ~/.bashrc
 +
 +
export GIT_AUTHOR_NAME='Harry Potter'
 +
export GIT_AUTHOR_EMAIL='harry@hogwarts.school.uk'
 +
export GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
 +
export GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
 +
export GIT_PS1_SHOWDIRTYSTATE=1
 +
export GIT_PS1_SHOWUNTRACKEDFILES=1
 +
export GIT_PS1_SHOWUPSTREAM=auto
 +
 +
# very handy to have your git branch and checkout status in your prompt:
 +
export PS1='\[\e[1m\]\u@\h:\w\[\e[32;1m\]$(__git_ps1 "(%s)")\[\e[m\e[1m\]\$\[\e[m\] '
 +
 
== Importing a CVS project from SourceForge into git ==
 
== Importing a CVS project from SourceForge into git ==
  

Revision as of 03:43, 11 November 2014

Handy git configuration

Put this in your ~/.gitconfig

[alias]
    lol = log --graph --decorate --oneline
[color]
    diff = auto
    branch = auto
    log = auto
    status = auto
[push]
    default = current
[user]
    name = Harry Potter
    email = harry@hogwarts.school.uk
[core]
    autocrlf = input
    pager = less -F -X

Bung these in your ~/.bashrc

export GIT_AUTHOR_NAME='Harry Potter'
export GIT_AUTHOR_EMAIL='harry@hogwarts.school.uk'
export GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
export GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWUPSTREAM=auto

# very handy to have your git branch and checkout status in your prompt:
export PS1='\[\e[1m\]\u@\h:\w\[\e[32;1m\]$(__git_ps1 "(%s)")\[\e[m\e[1m\]\$\[\e[m\] '

Importing a CVS project from SourceForge into git

First, grab a clone of the remote CVS repository. The easiest way to do this with a SourceForge project, without having to actually use CVS and its pserver logins and whatnot, is to use rsync:

rsync -avz rsync://meta-extractor.cvs.sourceforge.net/cvsroot/meta-extractor cvs-clone

Now we're going to import the history of the relevant CVS module (in this case, "metadata-extractor") into a new git repository.

sudo apt-get install git-cvsimport
git cvsimport -C meta-extractor.git -p x -v -d $(pwd)/cvs-clone metadata-extractor

Now you can push your new git project to Github or somewhere:

cd meta-extractor.git
git remote add origin <your-new-git-repo>
git push --tags master

You're good to go!