adb related commands
Check device resolution:
adb shell wm size
View screen density (DPI):
adb shell wm density
adb screenshot command
//截图保存到设备的/sdcard/目录下并且命名为screen.png
adb shell screencap -p /sdcard/screen.png
//下载设备/sdcard/目录下screen.png到电脑的当前目录下
adb pull /sdcard/screen.png
view port
netstat -ano | findstr "5037"
Kill the corresponding occupied pid
pid taskkill -f -pid 5340
View the number of threads in the top 10
adb shell top -m 10 -s thr
View the memory usage of the specified package name
adb shell dumpsys meminfo com.xxx.xxx
Git related
The main reason for Chinese garbled characters is that utf-8 encoding (root source) is not used, so the following commands need to be used
git config --global i18n.commitencoding utf-8
git config --global i18n.logoutputencoding utf-8
export LESSCHARSET=utf-8
But there is no problem with git bash input at all, but the sentence export LESSCHARSET=utf-8 in android studio shows that 'export' is not an internal or external command, nor is it a runnable program or batch file. This is because the commands of git bash and linux are the same, and should be changed toset LESSCHARSET=utf-8
delete untracked files
git clean -f
Even the untracked directory is also deleted
git clean -fd
Even the untrack files/directories of gitignore are deleted together (use with caution, generally this is used to delete files such as compiled .o)
git clean -xfd
Before using the above git clean, it is recommended to add the -n parameter to see which files will be deleted first, so as to prevent important files from being deleted by mistake
git clean -nxfd
git clean -nf
git clean -nfd
git delete local branch and delete remote branch
Specific operation:
I am now on the dev20181018 branch and want to delete the dev20181018 branch
1 Switch to another branch first: git checkout dev20180927
2 Delete the local branch: git branch -d dev20181018
3 If you can’t delete it, you can force delete it, git branch -D dev20181018
4 If necessary, delete the remote branch (use with caution): git push origin --delete dev20181018
5 Fetch code from the public warehouse: git fetch origin dev20181018:dev20181018
6 Then switch branches: git checkout dev20181018
Note: The above operation is to delete personal local and personal remote branches. If you only delete personal local, please ignore step 4