window 默認輸入的賬戶和密碼第一次輸錯乃正,直接修改憑證
控制面板->所有控制面板項->用戶賬號->管理你的憑證
->Windows憑證->普通憑證列->編輯即可
window下面idea終端亂碼問題解決
打開git/etc/bash.bashrc文件起胰,末尾增加如下兩行:
export LC_ALL="zh_CN.UTF-8"
export LANG="zh_CN.UTF-8"
idea終端選擇Git\bin\bash.exe
idea版本控制選擇Git\bin\git.exe
Git全局設置
git config --global user.name "dongliyang"
git config --global user.email "dongliyang@quandashi.com"
指定遠程主機
git push -u origin master
上面命令將本地的master分支推送到origin主機移稳,同時指定origin為默認主機僻孝,后面就可以不加任何參數(shù)使用git push了
增加遠程主機
git init
git remote add origin http://git.quandashi.cn/dongliyang/phoenix-task.git
git add .
git commit -m "Initial commit"
git push -u origin master
修改主機名稱
git remote rename origin old-origin
推送所有
git push -u origin --all
git push -u origin --tags
推送當前分支并綁定為遠程分支
git push --set-upstream origin test_new_0719
Https永久記住密碼
永久記住密碼: git config --global credential.helper store
會在用戶主目錄的.gitconfig文件中生成下面的配置消略。
[credential]
helper = store
如果沒有--global,則在當前項目下的.git/config文件中添加。
當然良蒸,你也可以直接復制上面生成的配置到配置文件中技扼。
Https臨時記住密碼
默認記住15分鐘:
git config –global credential.helper cache
下面是自定義配置記住1小時:
git config credential.helper ‘cache –timeout=3600’
git rebase使用總結
git rebase -i [startpoint] [endpoint]
其中-i的意思是–interactive,即彈出交互式的界面讓用戶編輯完成合并操作嫩痰,[startpoint] [endpoint]則指定了
一個編輯區(qū)間,如果不指定[endpoint]窍箍,則該區(qū)間的終點默認是當前分支HEAD所指向的commit(注:該區(qū)間指
定的是一個前開后閉的區(qū)間串纺,開區(qū)間(a,b)不包含了兩邊)
// 合并從當前head到15f745b(commit id)
git rebase -i 15f745b
// 合并最近的兩次提交
git rebase -i HEAD~2
注釋:
pick:保留該commit(縮寫:p)
reword:保留該commit,但我需要修改該commit的注釋(縮寫:r)
edit:保留該commit, 但我要停下來修改該提交(不僅僅修改注釋)(縮寫:e)
squash:將該commit和前一個commit合并(縮寫:s)
fixup:將該commit和前一個commit合并椰棘,但我不要保留該提交的注釋信息(縮寫:f)
exec:執(zhí)行shell命令(縮寫:x)
drop:我要丟棄該commit(縮寫:d)
最后保存強推:git push -f|force(不建議生產預發(fā)布環(huán)境使用強推)
合并其他幾次中間分支到master
image.png
這張圖所描述的這樣纺棺,將 develop 分支中的 C~E 部分復制到 master 分支中去。
這時我們就可以用 git rebase 命令來實現(xiàn)了邪狞。
- 命令說明
// startpoint 第一個 commit id, endpoint 最后一個 commit id祷蝌,branchName 就是目標分支了。
$ git rebase [startpoint] [endpoint] --onto [branchName]
如:
git rebase C F --onto master
執(zhí)行 git rebase 命令之后帆卓,我們發(fā)現(xiàn)當前的 HEAD 處于游離狀態(tài)巨朦。
git checkout master
所以我們需要使用 git reset 命令,將 master 所指向的 commit id 設置為當前 HEAD 所指向的 commit id剑令。
git reset --hard F