Archive

For the GIT category

How to remove permanently an object in GIT

No Comments

To remove permanantly an object in a remote GIT repository, simply perform these steps. Prior executing them, go to the GIT project folder. This is the one having the .git folder.

git filter-branch -f --index-filter "git rm -rf --cached \
     --ignore-unmatch OBJECT-TO-DELETE" -- --all
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
git push --all --force

Replace OBJECT-TO-DELETE with the object to delete. For example, if you want to delete a complete folder called distributions located in the tools folder, replace OBJECT-TO-DELETE by tools/distributions

The local copy of the modified repository cloned else where will have to be re-cloned.

*** Keep a backup your repository before performing these operations ***.

Script to create a shared git project

No Comments

This script creates a git project to be shared among the users of the Unix group $GIT_GROUP. Every git project will be created into the directory $REPOSITORIES_BASE_DIR.

#!/bin/bash

# Base directory where the shared git project are.
REPOSITORIES_BASE_DIR="/home/git"
# Group in which the user's of the repositories must be a member of
GIT_GROUP=git

if [ $# -ne 1 ]; then
        echo 'Usage:' `basename $0` 'project-name'
        exit 1
fi

PROJECT_NAME=$1

cd "$REPOSITORIES_BASE_DIR"
git init --shared --bare "$PROJECT_NAME"
cd ..
find git/$PROJECT_NAME -type d | xargs setfacl -R -m d:g:$GIT_GROUP:rwX
sudo setfacl -R -m g:$GIT_GROUP:rwX git/$PROJECT_NAME

EGit does not shows project decorations

No Comments

EGit

Decorations are not displayed when some commits are not pushed EGit within the Eclipse IDE. These are the UP and DOWN arrows shown to the right of the project name in Eclipse Project Explorer. This issue can be resolved by going into the properties of the GIT repository in the Git Repositories view. Then click on Add Entry and add the following keys and values:

branch.master.remote = origin
branch.master.merge = refs/heads/master
Blue Taste Theme created by Jabox