本篇文章是在工作中剃斧,遇到的一些問題后暫時歸在這里的一些命令碱呼,后期會整理發(fā)布
git
- 在ubuntu 當中更新apt-get git repo:
sudo add-apt-repository ppa:git-core/ppa
#Then update the source list and upgrade git:
sudo apt-get update
sudo apt-get install git
- git 設置 alias
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.last 'log -1 HEAD'
- git 回退
git checkout -- readme.txt
命令git checkout -- readme.txt意思就是,把readme.txt文件在工作區(qū)的修改全部撤銷蔗牡,這里有兩種情況:
一種是readme.txt自修改后還沒有被放到暫存區(qū)颖系,現(xiàn)在,撤銷修改就回到和版本庫一模一樣的狀態(tài)蛋逾;
一種是readme.txt已經(jīng)添加到暫存區(qū)后集晚,又作了修改,現(xiàn)在区匣,撤銷修改就回到添加到暫存區(qū)后的狀態(tài)。
總之蒋院,就是讓這個文件回到最近一次git commit或git add時的狀態(tài)亏钩。
docker
-
docker命令不需要敲sudo的方法
由于docker daemon需要綁定到主機的Unix socket而不是普通的TCP端口,而Unix socket的屬主為root用戶欺旧,所以其他用戶只有在命令前添加sudo選項才能執(zhí)行相關操作姑丑。
如果不想每次使用docker命令的時候還要額外的敲一下sudo,可以按照下面的方法配置一下辞友。
* 創(chuàng)建一個docker組
sudo groupadd docker
* 添加當前用戶到docker組
sudo usermod -aG docker $USER
* 登出栅哀,重新登錄shell
- docker 相關命令
- 查看docker 容器 image id
docker image docker images hyperledger/fabric-tools:latest --format {{.ID}}"
- 進入docker容器
docker exec -it 343435445(image Id) bash
- docker 容器更新軟件
如果每次進入容器都需要apt-get update, 然后再apt-get install, 一般人都會崩潰吧震肮。
docker commit 213123123sd(image Id) hyperledger-fabric:latest(name)
- 查看docker 容器 image id
npm
- 設置淘寶源
npm config set registry https://registry.npm.taobao.org