Epics@GSI Webhome

Git Tricks Tips


This is my personal collection of how'tos using git.

Importing cvs into git, including history

How to "Import a CVS repository into a bare git repository"

<div style="text-align:right"><a style="font-size:smaller" href="/edit/Epics/GitTricksTipsImportCvsIntoGitIncludingHistory">edit</a></div>

    # External CVSROOT, e.g. scs@lx-pool.gsi.de:/misc/hadesprojects/slowcontrol/cvsroot/
    URL_CVSROOT_EXTERNAL=<[User@]external CVSROOT directory>,
    CVSROOT_LOCAL=<local CVSROOT directory>
    # Git repository path: e.g. "hadesprojects-slowcontrol.git"
    GIT_TARGET_DIR=<New Git Repository>,
    # CVS Module to import MODULE=<CVS Module to extract>

    [ ! -z "$CVSROOT_LOCAL" ] mkdir -p "$CVSROOT_LOCAL" &&
    [ ! -z "$URL_CVSROOT_EXTERNAL" ] && rsync --progress -a "$URL_CVSROOT_EXTERNAL/" $CVSROOT_LOCAL
    git init --bare &&
    [ ! -z "$MODULE" ] && time git cvsimport -i -o cvshead -p xv -v -k -d $CVSROOT_LOCAL -C $GIT_TARGET_REPOSITORY $MODULE >&/tmp/cvsimport.log ||
    echo "import of module \'$MODULE\' of CVS repository \'$URL_CVSROOT_EXTERNAL\' into \'$GIT_TARGET_REPOSITORY\' failed"

-- PeterZumbruch - 2014-11-03


git submodule
, illustrated in a few command line examples.
TIP These examples require at least version 1.7.

<div style="text-align:right"><a style="font-size:smaller" href="/edit/Epics/GitTricksTipsSubmodule">edit</a></div>

adding a submodule to a git directory

  • git submodule add
  • git submodule
  • git submodule init

retrieving a repository with submodules

  • git clone
  • git submodule update

converting a repository into projects with submodules

  • create new branch
  • go into sub directory
  • git init
  • create remote bare repository
  • push to (final) remote repository
  • delete local sub directory and
  • replace by add submodule pointing to remote,
  • commit
  • checkout and test
  • merge new branch into current "master"

-- PeterZumbruch - 2014-11-03

Git Workflow

<div style="text-align:right"><a style="font-size:smaller" href="/edit/Epics/GitTricksTipsWorkflow">edit</a></div>

Possible Git Workflow



-- PeterZumbruch - 2014-11-14

-- PeterZumbruch - 14 Nov 2014
-- PeterZumbruch - 2014-11-14
Topic revision: r4 - 2014-11-14, PeterZumbruch - This page was cached on 2024-06-19 - 13:58.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Legal notice | Privacy Policy (german)