Elijah Lofgren

I follow Jesus Christ and enjoy reading, writing, helping people, and making websites. Who is Jesus?

My life mission: "Whatever you do, do it all for the glory of God." - 1 Corinthians 10:31

You are here: Home » Linux Tips » Git Tips

Contents

Git Tips

Useful git-related pages

Elijah's Git cheatsheat:

How To Use git-svn to Easily Create NICE Patches for All Your SVN Commits

 

Checkout starting from an SVN repo:

svn log https://svn.perl.org/parrot/trunk|head
git-svn
fetch -r17048

Or:

elijahlofgren@kubuntu:~/www/silverstripe-gsoc$ mkdir sharethis
elijahlofgren@kubuntu:~/www/silverstripe-gsoc$ cd sharethis/
elijahlofgren@kubuntu:~/www/silverstripe-gsoc/sharethis$ git-svn init http://svn.silverstripe.com/open/modules/sharethis/trunk/
Initialized empty Git repository in .git/
elijahlofgren@kubuntu:~/www/silverstripe-gsoc/sharethis$ svn log http://svn.silverstripe.com/open/modules/sharethis/trunk/ --limit 1
------------------------------------------------------------------------
r39763 | lperera | 2007-08-08 17:56:25 -0500 (Wed, 08 Aug 2007) | 1 line

Changes to the README file
------------------------------------------------------------------------
elijahlofgren@kubuntu:~/www/silverstripe-gsoc/sharethis$ git-svn fetch -r39763
        A       images/icons/reddit.gif
...

        A       README
W: +empty_dir: javascript
W: +empty_dir: templates/Includes
W: +empty_dir: templates/Layout
r39763 = 797a01c72d170d45a7f884a61a231fa0852fe27b (git-svn)

Checked out HEAD:
  http://svn.silverstripe.com/open/modules/sharethis/trunk r39763
 

Download new revisions from SVN:

git-svn fetch 

Create a branch in order to push to http://repo.or.cz/w/silverstripe-elijah.git 

 git-checkout -b tiny_mce2

 git push git+ssh://repo.or.cz/srv/git/silverstripe-elijah.git tiny_mce2

Pust to git repo:

push git+ssh://repo.or.cz/srv/git

Committing (I use Cogito so I can use a commit-post hook for CIA)

Can use cg-commit, cg-diff, etc, like SVN. :) 

 

/silverstripe-elijah.git master
or
git push git+ssh://repo.or.cz/srv/git/silverstripe-elijah.git delete-fixes

Manually send a commit notification to CIA (if you have that setup in a post-commit hook):
./.git/hooks/post-commit 0c4a5bd941eba3d67cad67d6287b89677b775c24 delete-fixes

View commits:
git-log

Commit to SVN:
git-svn dcommit

List branches:
git branch

After creating a branch, merge it to master
git-merge delete-fixes

Then delete the branch:
git branch -d delete-fixes

Start web interface:
git-instaweb
 
More info:
http://utsl.gen.nz/talks/git-svn/intro.html#howto-fetch-head 

Fix "update-index --refresh: command returned error: 1" error

elijahlofgren@kubuntu:~/www/silverstripe-gsoc/cms$ git-svn rebase
.dotest/0002: needs update
...
.dotest/whitespace: needs update
update-index --refresh: command returned error: 1
 elijahlofgren@kubuntu:~/www/silverstripe-gsoc/cms$ git-log
commit ac3cf2659cab01afe99e5952c3501d6617b24af7
Author: Elijah Lofgren <elijahlofgren@kubuntu.(none)>
Date:   Thu Aug 16 12:49:03 2007 -0500

    Merge in SVN stuff

commit d7b488f81157b2143fa2c4a0d76a779af31dbcf3
Author: Elijah Lofgren <elijahlofgren@kubuntu.(none)>
Date:   Tue Aug 14 14:37:13 2007 -0500

    Fix silverstripe_version

commit 67096a4bd9dec9e4e06b49100fe94600373d8695
elijahlofgren@kubuntu:~/www/silverstripe-gsoc/cms$ git reset d7b488f81157b2143fa2c4a0d76a779af31dbcf3
lang/en_US.php: needs update

 elijahlofgren@kubuntu:~/www/silverstripe-gsoc/cms$ cg-commit --no-hooks -m "Fix git lang merge file"
M lang/en_US.php
Committed as d056fe23423ad7f62228c933f36ec1c759d81e95
elijahlofgren@kubuntu:~/www/silverstripe-gsoc/cms$ git-svn rebase
Current branch master is up to date.

Some commands  I used when working on SilverStripe: 

git-svn rebase (NOT git-svn fetch in order to actually apply new updates to local)
git-svn add
git push git+ssh://repo.or.cz/srv/git/silverstripe-elijah.git tiny_mce2
git-format-patch -o ~/silverstripe/patches/

Automatically notice any modified (but not new) files, add them to the index, and commit, all in one step

Modified: 2008-05-23 10:56:48

git commit -a