Git常用操作

git pull 拉远程分支并合并到本地
git fetch 拉远程分支不做合并
忽略文件 .gitignore
添加文件 git add .
提交所有修改 git commit -am ‘备注信息’
推送本地分支到仓库 git push origin master:master
删除远端分支 git push origin :test
从拉远端代码到本地仓库 git pull origin master:master
根据分支创建新分支 git checkout -b dev2 master
切换分支 git checkout dev2
删除本地分支 git branch -d dev2
强制删除本地分支 git branch -D dev2
查看所有分支 git branch -a
查看所有远端分支 git branch -r
删除本地存在远端不存在 git branch -d -r origin/test
拉取远端分支到本地 git fetch origin dev
拉去远端并合并本地 git pull origin dev 可能会有冲突
暂存修改记录 git stash (可以把新增文件add仓库一起暂存)
查看暂存记录 git stash list
删除暂存 git stash drop 暂存编号
清除暂存 git stash clear
弹出暂存 git stash pop
撤销未提交修改 git checkout filename
撤销已提交修改 git reset –hard|–soft 版本
撤销已push修改 git revert -n commitID (解决冲突、提交、push)
Posted in Git, Tools | Leave a comment

git还原操作git reset、git revert和git checkout区别

1、git checkout
使用场景:误删除仓库当中还存在的文件或者撤销未提交的修改
git checkout 1.php

2、git reset
使用常见:已commit或已commit并push
git reset [--hard|soft|mixed|merge|keep] [<commit>或HEAD]:将当前的分支重设(reset)到指定的<commit>或者HEAD(默认,如果不显示指定commit,默认是HEAD,即最新的一次提交),并且根据[mode]有可能更新index和working directory。mode的取值可以是hard、soft、mixed、merged、keep。下面来详细说明每种模式的意义和效果。
查看提交历史
git log
commit 3
commit 2
commit 1
执行
git reset –hard HEAD~1
或者git reset –hard HEAD^
再执行git log
commit 2
commit 1
git status没有任何内容
git reset –soft HEAD~1
git status会显示上次提交的文件
如果–hard回滚之后需强制推才可以!!

3、git revert
git rever HEAD^
git rever -n commitId
解决冲突,提交,push

Posted in Git, Tools | Tagged , , | Leave a comment

配置phpmyadmin管理多个server

//修改librarise/config.default.php
$cfg['AllowArbitraryServer'] = true; //默认是false,改成true 
最后添加
 
$hosts = array(
'1'=>array('host'=>'127.0.0.1','user'=>'root','password'=>'123456'),
'2'=>array('host'=>'127.0.0.2','user'=>'root','password'=>'123456')
);
for($i=1;$i<=count($hosts);$i++){
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host'] = $hosts[$i]['host'];
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['user'] = $hosts[$i]['user'];
$cfg['Servers'][$i]['password'] =$hosts[$i]['password'];
 
}
Posted in PHP | Leave a comment

关闭Ubuntu提示欢迎语

Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-32-generic x86_64)

* Documentation: https://help.ubuntu.com/

System information as of Fri Sep 23 09:31:54 CST 2016

System load: 0.3 Processes: 254
Usage of /: 2.3% of 114.33GB Users logged in: 1
Memory usage: 4% IP address for eth0: 10.200.10.203
Swap usage: 0%

Graph this data and manage this system at:

https://landscape.canonical.com/

276 packages can be updated.
170 updates are security updates.

New release ’16.04.1 LTS’ available.
Run ‘do-release-upgrade’ to upgrade to it.

编辑/etc/pam.d/sshd
session optional pam_motd.so motd=/run/motd.dynamic noupdate
session optional pam_motd.so # [1]
屏蔽这两行即可

Posted in LINUX | Tagged | Leave a comment

上拉加载更多

 <div id="content_drop">
  <ul id="content_list">
  <li>第一个</li>
  <li>第二个</li>
  </ul>
  </div>
$(function(){
    var counter = 2;//开始加载
    var num = 6;//每页数量
    //容器外层
    $('#content_drop').dropload({
        scrollArea : window,
        loadDownFn : function(me){
            $.ajax({
                type: 'GET',
                url: 'index.php?p='+ counter,
                dataType: 'json',
                success: function(data){
                	if(data.status  !=0){
                        // 锁定
                        me.lock();
                        // 无数据
                        me.noData();
                    } else {
                    	var result = '';
                        counter++;
                        for(var i = 0; i < num; i++){
                        	//处理内容
                        }
                        $('#content_list').append(result);
                        me.resetload();
                    }
                },
                error: function(xhr, type){
                    console.log('Ajax error!');
                    me.resetload();
                }
            });
        }
    });
});

参考:https://github.com/ximan/dropload

Posted in HTML, JavaScript | Leave a comment