git svn clone https://subversion.my.com/svn/mysvnproj mygitproj
然後以後要從 svn update,對應的是:
git svn fetch
fetch 完,自己工作的 branch 要 update,還要下一次:
git svn rebase
git svn clone https://subversion.my.com/svn/mysvnproj mygitproj
git svn fetch
git svn rebase
git tag -d 12345delete remote:
git push origin :refs/tags/12345
git reset --hard ed2b7f3501f6這樣,用 git log 看,最後會在 commit ed2b7f3501f6 的地方。
.git/hooks/prepare-commit-msg
#!/bin/sh if test -r "checkpatch.pl"; then git diff --cached | ./checkpatch.pl --no-signoff --no-tree - fi檢查project 目錄是不是有 checkpatch.pl 好決定是不是要 執行
! grep -qs "\[NO_STYLE_CHECK\]" "$1" || exit 0就可以在 commit 時,加入 "[NO_STYLE_CHECK]" bypass 掉 checkpatch:
$ git commit -am "[NO_STYLE_CHECK] try commit dirty codes"
#!/bin/sh # # pre-commit hook to run check-patch on the output and stop any commits # that do not pass. Note, only for git-commit, and not for any of the # other scenarios # # Copyright 2010 Ben Dooks,if git rev-parse --verify HEAD 2>/dev/null >/dev/null then against=HEAD else # Initial commit: diff against an empty tree object against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi git diff --cached $against -- | ./scripts/checkpatch.pl --no-signoff -
$ git revert COMMIT-SHA
git log commit A ... commit B ... commit C ..就要反過來:
git revert A git revert B git revert C
machine my.git.com login checko password mygitpassword.. 對,是明文 ..
Initialized empty Git repository in /xxxx/xxxx/.git/ Password: error: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none while accessing https://xxxx@xxxx.xxxx/xxxx/xxxx.git/info/refs fatal: HTTP request failed這時候就加上這個還就可以:
export GIT_SSL_NO_VERIFY=1
:set noro就可以了..
$ git checkout --track -b merge10.4 aosp/merge10.4
git init
git remote add myserver git://.....
git pull myserver
$ git clone ssh://charles@servername/~/mysourcecode
.. 可以用 ~ 就不用寫一堆 /home/charles/...$git rev-parse --abbrev-ref HEAD
這要 git 1.6.3 以上版本才有效$git branch
會 show 出所有 branch 和目前 branch,$repo forall -p -c 'git rev-parse --abbrev-ref HEAD'
git log --grep="camera"git diff -w :set diffopt+=iwhitegit format-patch 'rev-name'產生一堆從 'rev-name' 開始的patch , 一個 commit,一個 patch。git am 'patch-filename'一個一個上回去。git am *.patchgit reflog
afa93f0 HEAD@{0}: rebase: tidy up the driver/misc/Makefile, keeps the 9.4 kernel content, just append the new source added by us
7a3b48e HEAD@{1}: checkout: moving from rtk2 to 7a3b48ec1ba6eee2298ee654c0cee1e06f464fed^0
f4fbe68 HEAD@{2}: checkout: moving from rtk to rtk2
6d5d23c HEAD@{3}: checkout: moving from rtk to rtk
6d5d23c HEAD@{4}: checkout: moving from rtk2 to rtk
f4fbe68 HEAD@{5}: checkout: moving from debug_suspend_wakeup to rtk2
4c13583 HEAD@{6}: commit: add more comment : wake_lock_internal & alarm.c
d8cf098 HEAD@{7}: rebase: add a lot message to trace the lock sequence
fe3b73a HEAD@{8}: rebase: use external sd as boot
f4fbe68 HEAD@{9}: checkout: moving from debug_suspend_wakeup to f4fbe680ef41ed3d38ecc1f49a8b2c32a294c178^0
733e20f HEAD@{10}: checkout: moving from rtk2 to debug_suspend_wakeup
f4fbe68 HEAD@{11}: commit: tidy up the driver/misc/Makefile, keeps the 9.4 kernel content, just append the new source added by us
6d5d23c HEAD@{12}: checkout: moving from rtk to rtk2
6d5d23c HEAD@{13}: checkout: moving from imx_r9.4 to rtk
901321c HEAD@{14}: checkout: moving from rtk to imx_r9.4
6d5d23c HEAD@{15}: checkout: moving from 37bace68774d42fc2bea3b2aa2fb8aafb3a6f5a0 to rtk
37bace6 HEAD@{16}: checkout: moving from rtk to 37bace68774d42fc2bea3b2aa2fb8aafb3a6f5a0
6d5d23c HEAD@{17}: checkout: moving from debug_suspend_wakeup to rtk
git log --pretty=oneline HEAD@{11}
f4fbe680ef41ed3d38ecc1f49a8b2c32a294c178 tidy up the driver/misc/Makefile, keeps the 9.4 kernel content, just append the new source added by us
6d5d23c54c2198831014b13d2f85f6f353f9e878 merge from 9.1: dimmer & brake gpio initial setting
911b3e5a7aced34f107715ebe4a1c09f8228c683 switch the sdcard init sequence, to make emmc as mmc0 always
a56e643558b691e5db349f0e630acc8e4e768cd4 Merge branch 'rtk' of git://robot/linux-2.6.35.y into rtk
8269efc25f3339750c7c9d05be88bc3232930f05 fix bug: system data abort due to audio-p driver
698afa31b154d7ea6ac6a3ba8664678e14fbbc97 fix bug: system data abort due to audio-p driver
git reset --hard HEAD@{11}git describeUntracked working tree file blah would be overwritten by mergegit clean把所有沒有 track 的file 刪掉,就可以 checkout 到另一個 branch。 git clean -f
強制刪除所有untrack 的 file.git clean -f -d
這樣就會把 untracked folder 也刪除。