git diff 檔案
git log 中文亂碼export LESSCHARSET=utf-8
如果看到一堆紅色 ,應該是權限問題
git config --global core.filemode false
git config core.filemode false
換行問題
git config --global core.autocrlf false
ssh免密碼
1: eval `ssh-agent -s`
2: chmod 700 jimmy.chen
2: ssh-add jimmy.chen
空目錄自動添加.gitignore
find . \( -type d -empty \) -and \( -not -regex ./\.git.* \) -exec touch {}/.gitignore \;
google code git push , 錯誤 returned error: 500
Edit local .git/config
修改
url = https://skyson22@code.google.com/p/jimmy-android-practice
紅字部分刪除.
git config --global merge.tool kdiff3
~user/ 下產生 .gitconfig
git log --since="2013-09-03" --until="2013-09-05" -p -10
git show 70278c8fb37245f21e2b4973
git log -g --grep=search_for_this
git branch <name> <SHA1>
git branch -D branch_name
多行註解
git commit 完了以後 , 會開啟文字編輯器 , 此時可以多行註解 , 但是下面有檔案變動的訊息
並不會提交到log去 , 只是做最後的確認.
git format-patch 32579d61fc6da3a56bbc6730eec0920fa42ff3fc -2
git format-patch -1 <sha>
是以commit這個時間點往前數
git am 0002-system-add-load-default-file.patch
但是unix格式必須用
git diff 385118015f3d ae88e4e2ecd5 > iser.patch
load putty key為灰色請改為
git conflict解決方式.
server安裝kdiff3
git config --global merge.tool kdiff3
透過ui方式解決.
如果是kdiff3解決不了的,
git checkout --ours -- path/to/file.txt
git checkout --theirs -- path/to/file.txt
git add path/to/file.txt
自行處理完後,使用git add 歸類已解決...
git status -uno 可以不顯示,不追蹤的部份,畫面精簡多,但是有可能忽略.
在別的branch
git branch -m old-branch new-branch
就在branch
git branch -m new-branch
log只顯示 檔案
git diff-tree --no-commit-id --name-only -r 6a69e50427e80
git svn時. git svn rebase取代 git pull
Review Board:
post-review --parent=origin/master -n
post-review --diff-filename=mycode.diff
post-review --diff-filename=package.diff --parent=origin/master -n
-n:顯示比對結果 但是不提交
git config reviewboard.url http://reviewboard.example.com
post-review --parent=sprt_apple_1 --debug --repository-type=git --revision-range=af96a9:8b9f3425
打包特定commit.
git archive -o export.zip <COMMIT>
有時做這件事.kconfig會出現#內容,導致編譯不過.後來改用.
git archive master | bzip2 >source-tree.tar.bz2
kconfig為正常
回到特定的版本
git reset --hard HEAD~1 會將不存在的commit檔案刪掉
git reset --soft HEAD~1 跟上面動作的差別是,不會刪掉.
git add到cache之後,一樣可以diff
git diff --cached
只顯示檔案
git show ccc885a1604de0eef099847db09d19 --pretty="format:" --name-only
review source code時用的指令
The --parent option is not valid for the current SCM client.
post-review --parent=master --debug --repository-type=git
post-review --revision-range=STARTREV:STOPREV
合併commit
http://zerodie.github.io/blog/2012/01/19/git-rebase-i/
git add -u
一次性更新已追蹤檔案到git add. 但是未追蹤檔案並不會加入
Unable to determine upstream SVN information from working tree history
#git rebase --onto git-svn --root
#git svn fetch
#git svn rebase
git log 找已經被刪除的檔案,
git log --all -- root_init/usr/sbin/haha.php
git log 找已經刪除的code.
git log -S 'generic_file_aio_write' mm/filemap.c
git log -G 'generic_file_aio_write' mm/filemap.c <---找整個字串的歷史
找出git rebase 之前的紀錄
git reflog
git reset --hard HEAD@{5}
將putty格式的ssh key轉成linux,並寫入ssh config
sudo apt-get install putty putty-tools puttygen private.ppk -O private-openssh -o private_key.ssh git config user.email "jimmy.chen@hotmil.com.tw" git config user.name "jimmy.chen" vim ~/.ssh/config Host 192.168.70.9 User git HostName 192.168.70.9 Port 22 IdentityFile ~/.ssh/gitlab.ssh (如果只寫這行, 則為通用)
或者
git clone git@GitLab.haha.com:haha/haha.git --config core.sshCommand="ssh -i ~/.ssh/private_key_gitlab.ssh"
建立新的專案
cd existing_git_repo git remote add origin git@192.168.70.9:root/haha.git git push -u origin master
git stash加上註解
git stash save "add style to our site"
可以從stash拿部分的檔案, 而不用整個stash apply
git checkout stash@{0} -- <filename>
沒有留言:
張貼留言