痞
痞
痞子軍團本部
Search…
痞
痞
痞子軍團本部
痞子軍團本部
軟體開發
軟體工程
Eclipse
Git
GitHub
Scrum
雜七雜八
Portfolio
Powered By
GitBook
Git
基本概念
移動、改名要用
git mv
,不然會被 git 認為是「刪除一個檔案 + 新增一個檔案」。
Eclipse(至少在 Mars)用 Refactor / Rename 修改 Java class, 會用
git mv
做,可以安心直接使用。
設定
Windows 上設定 Notepad++ 為 commit editor (在 2.26.x 安裝時可以設定連結的 editor,不用再自己搞了),
1
git config --global core.editor "'C:\Program Files (x86)\Notepad++\notepad++.exe' -multiInst -nosession -noPlugin"
Copied!
設定 username 跟 email
1
git config user.name Foo
2
git config user.email
[email protected]
Copied!
gitk 使用 UTF-8 編碼(在 2.26.x 被炸到)
1
git config --global gui.encoding UTF-8
Copied!
branch 相關
開啟一個完全沒有 parent 的 branch(在這裡是
gh-pages
)
1
git checkout --orphan gh-pages
Copied!
刪除 branch
1
git branch -d wtfBranch
Copied!
強制刪除 branch(沒有 merge 的話就需要)
1
git branch -D wtfBranch
Copied!
刪除 remote 上的 branch
1
git push fooRemote :wtfBranch
2
git push fooRemote --delete wtfBranch
Copied!
抓 remote 的某個 branch 變成 local 的 branch
1
git fetch fooRemote remoteBranch:localBranch
Copied!
pull / push
pull
時不想產生一個 merge commit(也有
寫入設定檔的招式
)
1
git pull -r
2
git pull --rebase
Copied!
所有 branch 都 push 上 remote
1
git push --all origin
Copied!
版本推進流程
1.
pom 檔版號拿掉
SNAPSHOT
、寫
Release.md
,commit
2.
掛上版號 tag
1
git tag wtf.foo.bar
Copied!
3.
pom 檔版號進版,加上
SNAPSHOT
,commit
4.
推上 remote repo(所有 tag 都上)
1
git push origin --tags
Copied!
SVN repo 匯入
1.
用 git svn 取出 repo
1
git svn clone SVN_URL REPO_NAME
Copied!
2.
用 git log 找出系統產生的 commiter email (假設為
foo <
[email protected]
>
)
3.
用 git filter-branch 修正
1
git filter-branch --commit-filter '
2
if [ "$GIT_AUTHOR_EMAIL" = "
[email protected]
" ];
3
then
4
GIT_AUTHOR_NAME="FOO";
5
GIT_AUTHOR_EMAIL="
[email protected]
";
6
git commit-tree "
[email protected]
";
7
else
8
git commit-tree "
[email protected]
";
9
fi' HEAD
Copied!
4.
因為不知道怎麼改上面那段程式碼,所以只好有幾個 author 就做幾次 [死]
5.
確定改完後作 git push
Previous
Eclipse
Next
GitHub
Last modified
2yr ago
Copy link
Contents
基本概念
設定
branch 相關
pull / push
版本推進流程
SVN repo 匯入