git
git installation
copy epel.repo to /etc/yum.repos.d/
yum search git-svn
>git-svn.x86_64
yum install git-svn
>GPG key retrieval failed:。。。。 No such file or directory: '/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL'
cd /etc/pki/rpm-gpg/
wget http://download.fedora.redhat.com/pub/epel/RPM-GPG-KEY-EPEL
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
yum install git-svn
> Complete!
Checkout the project
git clone
git@github.com:vkuznet/PyQueryBuilder.git
Review modification
git status
Add file/dictionary
git add README
Commit modification
git commit -a -m "YOUR COMMENT"
push modification to remote branch
git push origin master
Patch management on client with stg
Checkout the project
git clone git@github.com:vkuznet/PyQueryBuilder.git
#Configure remotes
#When a repo is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repo it was forked from.
#To keep track of the original repo, you need to add another remote named upstream:
git remote add upstream git@github.com:vkuznet/PyQueryBuilder.git
git fetch upstream
git merge upstream/master
Initialise Stacked Git in the cloned git repository.
stg init
Start developing patches in local 'mydev' against 'remotes/trunk'.
# Create stg and git branch.
stg branch -c mydev
# Start a new patch called improve-layout that fixes the problem in ticket 123
stg new -m "Improve layout of sites page, fixes #123" improve-layout
vi src/templates/SiteDB/sitelist.tmpl # Make changes to the necessary files
stg refresh # Add those changes into your current patch
stg show # Show the changes you have made in the current patch
stg series -a -d # Show the patch series in your stack
# edit patch comment (stg edit), add new patches etc. etc.
touch my_new_file # Create a new file
git add my_new_file # Add the file to git
stg refresh # Add that change into your current patch
stg show # Review patch, should include new files too
send out a patch
stg mail
# to local filesystem
stg export -d ~/ -n -p patch_name
Once your patch has been accepted and committed you will need to bring your private repository up to the SVN head and clean out your old patches. This is done by issuing
stg commit
stg branch master
stg branch --delete mydev
stg branch -c mydev
stg pull -m # Bring code up to SVN head
stg clean # Clear out the local copy of your, now committed, patches
Patch management on master with git
apply a patch via git
git apply --check patch_name
git apply patch_name
git am --signoff < fix_empty_poster.patch
# review patches and then commit
git status
git commit -a
update github
git push origin master
git undo and redo
git commit ...
git reset --soft HEAD^
edit
git commit -a -c ORIG_HEAD
--
LiangDong - 2011-02-01