Posts tagged ‘git’

git cheatsheet

browsing the git history in a compact yet still highly condensed view containing all important information:

git log --graph --source --oneline --branches --tags

migrate from SVN to GIT

a short cheat sheet of commands I used several times to migrate SVN-repositories to GIT

  • preparation

    sudo aptitude install subversion git-svn
    svn co https://my.server.private/repos/my_repo
    cd my_repo
    svn log -q | grep -v '^--*$' | cut -d '|' -f 2 | sort | uniq > ../my_repo_authors.txt
    cd ..
    vim my_repo_authors.txt
    ### go ahead and edit the authors file
  • git-svn clone the subversion repository
    ### use "--no-metadata" only if you don't want the git-svn-id tags in the commit-messages
    git svn clone --no-metadata --stdlayout \
        --authors-file=my_repo_authors.txt \
        https://my.server.private/repos/my_repo \
        my_repo.git-svn
Continue reading ‘migrate from SVN to GIT’ »

git-svn workflows: working with svn-branches

git svn clone --stdlayout https://svnserver/repos/my_repo

display info about the svn-connection:

git svn info

display all known branches:

git branch -a

create a local branch tracking an existing branch from SVN (NOTE: for the local branch you have to use a different name than it is called in SVN because otherwise git-svn gets confused when switching branches and will create a new branch in ‘detached HEAD’ state, which means it is not connected to the SVN-branch!)

git checkout -b b_my_branch my_branch

show the new local branch, do something, commit to SVN, switch back to trunk:

git branch -a
echo test > testfile
git add testfile
git commit -m 'added testfile'
git svn dcommit
git checkout master
git svn info

git-svn: update only till a specific revision in svn

tracking a svn-repository using git-svn…

usually, you want to be up to date with svn and thus use “git svn rebase” to fetch changes from SVN, but what to do if you don’t want to update to the latest revision but, say, just fetch one (or 5…) new revision?

solution: use “fetch” and “rebase” in combination with the “—local” parameter:

git svn fetch --revision 3055:3060
git svn rebase --local

installing redmine on debian/lenny using mod_passenger

this is based on redmine-1.0.0

we need a more recent version of rails and rubygems than those shipped with lenny, so first add the backports-repository to your sources.list:

deb http://www.backports.org/debian lenny-backports main contrib non-free

then, update your package list:

sudo apt-get update

and install the above mentioned packages Continue reading ‘installing redmine on debian/lenny using mod_passenger’ »

cached: git-SVN: Whys And Hows (by amitu)

NOTE: this is just a copy of a blog-posting originally written by Amit Upadhyay. Since I found it really useful, I was rather disappointed to notice it has gone one day. Thankfully it still was in google’s cache, so I decided to make a copy. The rest of the article is a full-quote: Continue reading ‘cached: git-SVN: Whys And Hows (by amitu)’ »

git-svn workflows: switch to a specific revision in svn and back to head

first, update to current HEAD:

git svn rebase

then, look for the appropriate hash-name in git corresponding to the svn-revision:

git log | grep -C 5 "my-desired-revision"

switching to the revision is done by a checkout:

git co f914a51a99f09aa609f253fb24a5adcfe0014461

then, do your work, e.g. compiling…
to switch back, clean up the changes caused by your work:

git clean -df
git reset --hard

final step is to switch to the “master” branch, which contains the HEAD revision:

git co master

git and svn

by far the best article I’ve read for somebody used to subversion (and tied to an SVN-repo) who wants to use git locally:

Git-SVN: Whys And Hows

thanks!!