Skip to content

Instantly share code, notes, and snippets.

@mrnejc
Last active September 11, 2015 11:16
Show Gist options
  • Save mrnejc/63dd40e8af499ae438b1 to your computer and use it in GitHub Desktop.
Save mrnejc/63dd40e8af499ae438b1 to your computer and use it in GitHub Desktop.
my GIT cheatsheet

GIT-SVN

I like to work with GIT, but company SCM is SVN. To make my GIT project work with SVN:

  1. initialize GIT repo

$ cd /path/to/my/repo
$ git init

  1. initialize SVN directory and
    • it creates SVN repo inside .git path
    • it assumes we are using standard (-s) SVN structure

$ svn mkdir --parents protocol:///path/to/repo/PROJECT/trunk -m "Importing git repo"
$ git svn init protocol:///path/to/repo/PROJECT -s

  1. pull SVN

$ git svn fetch
$ git rebase trunk

  1. resolve any conflicts (shouldn't be any if SVN was empty),
    loop until its OK

$ git status
$ git add
$ git rebase --continue

  1. to commit to SVN do

$ git svn dcommit

procedure borrowed from a bit longer explanation on StackExchange

IGNORE MORE THAN .gitignore

to keep .gitignore clean from mess specific to my dev environment add dev-tool specific stuff to global gitignore file:

$ git config --global core.excludesfile ~/.gitignore_global
$ echo ".idea/**" > ~/.gitignore_global

add project specific stuff to project specific exclude file .git/info/exclude this will not be checked in to repo

$ echo "localdev.config" > .git/info/exclude
$ echo "testfiles/**" > .git/info/exclude

TOOLS

Some stuff that will help with using GIT:

  • This is the best bash prompt I've found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment