User Tools

Site Tools





git config --global color.ui "auto"

Working with my NAS

cd /mnt/nas/heinrich/git/
mkdir entintar.git
cd entintar.git
git --bare --shared init
# Initialized empty Git repository in /mnt/nas/heinrich/git/entintar.git/

# go back to my working folder
cd ~/work/entintar
git remote add origin /mnt/nas/heinrich/git/entintar.git/
git push origin master

Handle permission problems: see

Initialize a bunch of bare repositories

find -type d -name "*.git" -print -exec git init --bare {} \; -prune

// create a shell script to add remote
var repos = "using-wro4j photo-catalog DavidWebb doublemetaphone entintar" +
            " it-profile-generator mobile-detect.js mobile-usage mongodb-openvz-crashtest" +
            " my-slides nerdshow simplify-java";

repos.split(/ /).forEach(function (repo) {
  console.log('cd ' + repo);
  console.log('git remote add backup /mnt/nas/heinrich/git/github/' + repo + '.git');
  console.log('git push backup master --tags');
  console.log('cd ~/work/github/');

Not-everyday Git commands

Edit last commit message

git commit --amend -m "New commit message"

GIT process (contribute)

  • create an issue so the community can comment on your idea
  • fork spell
  • create a new branch git checkout -b my_branch
  • create tests for the changes you made
  • make sure you pass both existing and newly inserted tests
  • commit your changes
  • push to your branch git push origin my_branch
  • create a pull request

Migrate Subversion to Git

User mapping file

Create a mapping file to map SVN-Users to Git, e.g. userlist.txt:

hgoebl = Heinrich Goebl <>
scott = Scott Tiger <>


Install Subversion extensions for Git:

apt-get install git-svn

Clone a SVN project

git svn clone https://my-svn-server/path/to/my-project/ \
              -T trunk -b branches -t tags \
              --authors-file=userlist.txt --no-metadata

cd my-project

# init bare remote git repository (see above)

git remote add origin /my/path/to/remote/project.git
git push origin --all

Parts of an automation script

Create a text file with projects to migrate (in my case “~/work/retired/retired-projects”, created with “ls -1”).

Create the bare Git repositories:

while read PRJ
    mkdir ${PRJ}.git
    cd ${PRJ}.git
    git --bare init
    cd ..
done < ~/work/retired/retired-projects

Run this script in my NAS directory for Git (/mnt/nas/heinrich/git/retired/).

Change to the working directory (~/work/retired/).

Create and run a script to declare remote and push to origin:

while read PRJ
    cd ${PRJ}
    git remote add origin /mnt/nas/heinrich/git/retired/${PRJ}.git
    git push origin --all
    cd ..
done < ~/work/retired/retired-projects

Merge dev-branch to master

git checkout dev
git pull origin
git merge master
# resolve any merge conflicts
git checkout master
git merge dev
git push origin master
# switch back to dev branch
git checkout dev

Merge feature branch to master (squash)

Transport Changes

Other location:

git bundle create ../my.bundle --since=1day master

Transport my.bundle to dev location

Main dev location:

git fetch my.bundle master:new_branch_name_from_other_location
git merge new_branch_name_from_other_location

Public Repositories


# Ignore docs files

# Numerous always-ignore extensions

# OS or Editor folders

# Komodo

# grunt-html-validation

# Folders to ignore
misc/git.txt · Last modified: 2017/08/26 17:44 by hgoebl