git tips

git

Created 週五 17 二月 2012

merge partclone from github log: git remote add mdbooth https://github.com/mdbooth/partclone.git git fetch mdbooth git branch mdbooth-review mdbooth/review git checkout mdbooth-review

\<edit , asve, commit, test. revicew> \<normally, everything is fine, start merge>

git checkout master git merge mdbooth-review git push origin master

\<but, i want to merge some commit only> git checkout master git cherry-pick -n xxxxx git cherry-pick -n xxxxx git cherry-pick -n xxxxx.... git push origin master

\<in this case, I want to come back special revision and ignore some update.> git reset a8b5a0afe git checkout -f git reset original/master git add-u git commit -m 'come baclk' git push

add remote branch amy\$ git branch

  • master

amy\$ git branch v0 amy\$ git push origin v0 Total 0 (delta 0), reused 0 (delta 0) To file:///home/gitadmin/project1.git

  • [new branch] v0 -> v0

amy\$ git pull origin v0 From file:///home/gitadmin/project1

  • branch v0 -> FETCH_HEAD

Already up-to-date.

amy\$ git branch --set-upstream v0 origin/v0 Branch v0 set up to track remote branch v0 from origin.

remove remot branch git push origin :newfeature

remove remot tag git tag -d 12345 git push origin :refs/tags/12345

add tag with comment git tag -a v1.0.0 -m "Creating the first official version."

自動push 到 github, free然後更新網站 partclone.org 參考資料 http://stackoverflow.com/questions/1797074/local-executing-hook-after-a-git-push recently came across the same issue. I wanted a hook so that a push from my git submodule would commit the new submodule reference in the 'superproject'. This adds the following to your .git/config file: [alias] xpush = !git push origin master && update-server.sh And so now, if you type: \$ git xpush

your changes will be pushed, and then update-server.sh will be executed.

相關範例1: Git diff 產生 patch 並傳送

\$ git diff master\^ > change.diff \$ patch -p1 \< change.diff 或 git apply change.diff

相關範例2: Git patch 產生 與 匯入

\$ git format-patch origin/master –stdout > story.patch \$ git am \< store.patch

相關範例3: Git patches 產生、寄出、匯入

# format-patch -o (-o 會把 patches 都放到指定目錄下) \$ git format-patch -o patches origin # 會產生 patches 的目錄, 所有 patch 都會在此目錄下. \$ git send-email –to xxx@email.com patches # 將此目錄下的檔案都寄出 \$ git am mbox # 匯入.

Conference: Kent

git-cat-file -p

我的 [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = free:/home/gitpool/partclone_web_eng.git [branch "master"] remote = origin merge = refs/heads/master [remote "github"] url = git@github.com:partclone/partclone.github.com.git fetch = +refs/heads/*:refs/remotes/github/*

[alias] xpush = !git push && git push github && update_pcl_page.sh old convert log: ./git/tag%3E%20develop)

Comments