Git
在當(dāng)前目錄新建一個(gè)Git代碼庫(kù)????$ git init
新建一個(gè)目錄,將其初始化為Git代碼庫(kù)????$ git init[project-name]
下載一個(gè)項(xiàng)目和它的整個(gè)代碼歷史????$ git clone[url]
log ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?git log
修改commit內(nèi)容? ? ? ?? git commit --amend
還原? ????????????????????????????????git reset --hard HEAD^
配置信息????????????git config --list
修改配置 ? ? ? ? ? ?git config --global user.name "name"
? ??????????????????????????git config --global user.email "email@email.com"
分支改名 ? ? ? ? ? ?git branch -m (原名) 新名
強(qiáng)制push當(dāng)前提交,以達(dá)到撤銷目的?????git push origin branch –force
刪除遠(yuǎn)程tag?? ??git tag -d tag_name
? ??????????????????????????git push origin:refs/tags/tag_name
多用戶配置
SSH配置 ? ? ? ? ? ? ? ? ? ?vim ? ? /.ssh/config
# Company
? ? Host ***********
? ? HostName?***********
? ? PreferredAuthentications publickey
? ? IdentityFile ~/.ssh/id_rsa
# github
? ?Host github.com
? ?HostName github.com
? ?PreferredAuthentications publickey
? ?IdentityFile ~/.ssh/github_rsa
不要使用全局配置 ? ? ? ?git config --global?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(vim ?~/.gitconfig)
切換到分支目錄 ? ? ? ? ? ?git config --local user.name "your name"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?git config --local user.email "your email"
多用戶git user配置
需要取消git的全局設(shè)置:
git config --global --unset user.name?
git config --global --unset user.email
針對(duì)每個(gè)項(xiàng)目,單獨(dú)設(shè)置用戶名和郵箱,設(shè)置方法如下:
git config user.name "your_name"?
git config user.email "your_email"
倉(cāng)庫(kù)合并
cd repo1?
git remote add other ../repo2?
git fetch other?
git checkout -b repo2 other/master?
git checkout master?
git merge repo2?
解釋:
進(jìn)入repo1文件夾?
添加repo2作為repo1的遠(yuǎn)程倉(cāng)庫(kù),并命名為other?
將repo2的內(nèi)容獲取到repo1?
注意,使用fetch而不是pull,關(guān)于fetch和pull的區(qū)別請(qǐng)戳這里
在repo1中創(chuàng)建名為repo2的新分支,同時(shí)切換到該分支,并且使用上一步獲取的內(nèi)容中的master分支的內(nèi)容?
切換到repo1的master分支?
將repo2分支的內(nèi)容合并到master分支
刪除本地分支 ? ?git branch -D ..
Git 提交 type
feat????新增一個(gè)功能
fix????修復(fù)一個(gè)Bug
docs????文檔變更
style????代碼格式(不影響功能,例如空格、分號(hào)等格式修正)
refactor????代碼重構(gòu)
perf????改善性能
test????測(cè)試
build????變更項(xiàng)目構(gòu)建或外部依賴(例如scopes: webpack、gulp、npm等)
ci????更改持續(xù)集成軟件的配置文件和package中的scripts命令,例如scopes: Travis, Circle等
chore????變更構(gòu)建流程或輔助工具
revert????代碼回退
ADB
查看連接設(shè)備 ? ? ? ? ? ?adb devices
安裝 ? ? ? ? ? ? ? ? ? ? ? ? ? ? adb install apk路徑
卸載 ? ? ? ? ? ? ? ? ? ? ? ? ? ?adb uninstall 包名
啟動(dòng) ? ? ? ? ? ? ? ? ? ? ? ? ? ?adb shell am start -n com.iostyle.app/.ui.activity.SplashActivity
關(guān)閉 ? ? ? ? ? ? ? ? ? ? ? ? ? ?adb shell am force-stop com.iostyle.app
清理數(shù)據(jù) ? ? ? ? ? ? ? ? ? ? adb shell pm clear 包名
列出包名 ? ? ? ? ? ? ? ? ? ?adb shell pm list packages
? ? -三方 ? ? ? ? ? ? ? ? ? ? ? ?adb shell pm list packages -3
? ? -過濾 ? ? ? ? ? ? ? ? ? ? ? ?adb shell pm list packages | grep xx
獲取Android版本 ? ? ? ?adb shell getprop ro.build.version.release
獲取屏幕分辨率 ? ? ? ? ? ?adb shell wm size
獲取屏幕密度 ? ? ? ? ? ? ? ?adb shell wm density
Pull ? ? ? ? ? ? ? ? ? ? ? ? ? ? adb pull /sdcard/what ?~/where
Push ? ? ? ? ? ? ? ? ? ? ? ? ?adb push ?~/what ?/sdcard/where
System
DNS????????????????????????cat /etc/resolv.conf |grep -e "nameserver"?
查看端口占用信息 ? ? ? ? ? ? ?sudo lsof -i :prot
根據(jù)PID殺進(jìn)程: ? ? ? ? ? ? ??sudo kill -9 pid
環(huán)境變量? ? ? ? ? ? ? ? vim?/etc/paths
Linux
刪除當(dāng)前所有命令代碼 ? ?control + u
刪除光標(biāo)后命令代碼 ? ? ? ?control + k