Source Code Control

From Mosuma
Jump to: navigation, search

Git Tips

git filter-branch --tree-filter 'rm -rf directory/directory/directory/file' HEAD
git commit -m "permanently removed this file"
git push --force

Clone from gitmaster, Push to gitslave (For admins only)

Based on "this stackoverflow":http://stackoverflow.com/questions/5181845/git-push-existing-repo-to-a-new-and-different-remote-repo-server

guiyu@acer:~/gitslave$ git clone gitmaster:huangshuo
Cloning into huangshuo...
warning: You appear to have cloned an empty repository.
guiyu@acer:~/gitslave$ cd huangshuo

guiyu@acer:~/gitslave/huangshuo$ git config -l
color.ui=auto
user.name=Kuiyu CHANG
user.email=kuiyu.chang@mosuma.com
alias.st=status
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=gitmaster:huangshuo
branch.master.remote=origin
branch.master.merge=refs/heads/master

guiyu@acer:~/gitslave/huangshuo$ git remote rename origin upstream

guiyu@acer:~/gitslave/huangshuo$ git remote add origin gitslave:huangshuo

guiyu@acer:~/gitslave/huangshuo$ git config -l
color.ui=auto
user.name=Kuiyu CHANG
user.email=kuiyu.chang@mosuma.com
alias.st=status
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.upstream.url=gitmaster:huangshuo
remote.upstream.fetch=+refs/heads/*:refs/remotes/upstream/*
branch.master.remote=upstream
branch.master.merge=refs/heads/master
remote.origin.url=gitslave:huangshuo
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
# do some stuff git add; git commit -a
guiyu@acer:~/gitslave/huangshuo$ git pull upstream master && git push origin master

Git Installation

Git Advocacy

GIT sub-modules

GIT vs hg

GIT vs SVN

Gitolite

  • install gitolite
  • Gitolite
  • ACL with GIT
  • After setting up hooks, e.g., modifying /var/lib/gitolite/.gitolite/hooks/common/post-receive, you **must** run as gitolite gl-setup, otherwise the hooks won't be run

Installation guides

Git and Binary files like OpenOffice Docs