一些自用的命令收錄

Git


在當(dāng)前目錄新建一個(gè)Git代碼庫????$ git init

新建一個(gè)目錄,將其初始化為Git代碼庫????$ 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

針對每個(gè)項(xiàng)目,單獨(dú)設(shè)置用戶名和郵箱,設(shè)置方法如下:

git config user.name "your_name"?

git config user.email "your_email"


倉庫合并


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)程倉庫,并命名為other?

將repo2的內(nèi)容獲取到repo1?

注意,使用fetch而不是pull,關(guān)于fetch和pull的區(qū)別請戳這里

在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????代碼格式(不影響功能,例如空格、分號等格式修正)

refactor????代碼重構(gòu)

perf????改善性能

test????測試

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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 一、查看當(dāng)前顯示的Activitylinux:adb shell dumpsys activity | grep ...
    PrivateGO閱讀 2,218評論 0 0
  • 最近看到一些關(guān)于adb的相關(guān)知識,總結(jié)一下,這些常用的命令以后可以直接拿來用~ adb其實(shí)就是Android De...
    Mr_馮先生閱讀 4,461評論 0 10
  • 什么時(shí)候會(huì)最想結(jié)婚呢 大概就是在這樣的時(shí)候吧 不想再一個(gè)人面對這世間的艱難困苦
    蘞蔓于野閱讀 266評論 0 0
  • 番茄魚 拍圖的時(shí)候是快樂的!盡管任性,還是被滿足了。 可是今天,唉,同樣的話,不同心情去聽,真的很讓人心情低落吧!...
    咩的口水地閱讀 307評論 1 0
  • 莫名妙閱讀 247評論 0 1

友情鏈接更多精彩內(nèi)容