Keep Data in .git/refs

Git keeps references to heads (branches) and tags in .git/refs. This is very convenient because you can obtain the SHA1 ID of any tag just by doing cat .git/refs/tags/<tag_name>.

But this mechanism only works if you do not run git gc. The garbage collector packs tags by default, that means the files from .git/refs/tags will be removed and their SHA1 IDs will be stored in file .git/packed-refs instead.

To prevent this you can use the following in your .git/config:

[gc]
     packrefs = 0

See man git-pack-refs for more details.

Avoiding Tag Collisions

If you fetch tags from multiple remote repositories, it may happen that they will generate conflicts because all tags are stored in .git/refs/tags directory. This will happen, for example, if you fetch objects from both the sip-router git repository and also the repository at http://git.sip-router.org/ser. The reason is that both of them originate from a single cvs repository and thus they contain tags with identical names. To avoid this situation you can do the following in your .git/config:

[remote "sr"]
    ....
    fetch = refs/tags/*:refs/tags/sr/*
    tagopt = --no-tags

[remote "cvs"]
    ....
    fetch = refs/tags/*:refs/tags/cvs/*
    tagopt = --no-tags

The configuration above will fetch all tags from both repositories explicitly and will store them in subdirectories under .git/refs/tags to avoid conflicts in file names. Because you download tags explicitly you can tell git-fetch not to download any tags using the tagopt option.

GIT commands for merging of modules

This will show you how the git commands to merge modules, e.g. ser's avpops module is removed and K's avpops module is used as comon module.

# we start in the local master branch
git checkout master

# create a new local branch called "darilion/avpops" based on 
# the remote master branch, and checkout into the newly created branch
git checkout -b darilion/avpops origin/master

# remove the old ser module
git rm -r modules_s/avpops/

# move the Kamailio module into the common modules directory
git mv modules_k/avpops/ modules/

# do whatever is need, eg. modify the code, ...

# check if sip-router builds and the code is working as expected

# check the status (modified files)
git status

# add all modifications for the next commit
git add .

# commit the changes (which were added in the previous step)
# (this will commit into the local working branch, in this case darilion/avpops)
# make sure to add a commit message according to these rules:
#   http://sip-router.org/wiki/devel/git-commit-guidelines
git commit

# verify the commit
git log -1

# prepare for push into the remote master branch: make sure
# that our local branch is up2date with commits added to 
# remote main branch
git fetch origin
git rebase origin/master

# push our changes from the local "darilion/avpops" branch 
# into the remote master branch
git push origin darilion/avpops:master

# cleanup: change into another local branch and delete the local avpops branch
git checkout master
git pull --rebase origin master # fetch previously commited commit
git branch -d darilion/avpops

Navigation

Wiki

Other

Personal Tools