Skip to content

git相关

  1. clone远程仓库
    git clone -b 分支名 <版本库的网址> <本地目录名>

  2. 撤销上1次的提交内容
    git reset --soft HEAD^

  3. 撤销某文件的修改
    git checkout -- xx/xx

  4. 取消Git默认配置替换回车换行成统一的CRLF
    git config --global core.autocrlf false

  5. 忽略某些修改的文件,使其不提交
    git update-index --assume-unchanged xx
    恢复忽略
    git update-index --no-assume-unchanged xx
    若想要使整个文件夹都被忽略,可cd到文件夹目录
    git update-index -assume-unchanged $(git ls-files|tr 'n'”)

smartgit rebase合并,解决冲突时,theirs是本地更改的内容

修改已提交记录的作者信息

sh
# 修改最近1条记录
git commit --amend --author="{username} <{email}>" --no-edit

# 批量修改所有符合条件的记录
git filter-branch --commit-filter '
    if [ "$GIT_AUTHOR_EMAIL" = "wangxiang@qimingpian.com" ];
    then
            GIT_AUTHOR_NAME="wang1xiang";
            GIT_AUTHOR_EMAIL="756638369@qq.com";
            git commit-tree "$@";
    else
            git commit-tree "$@";
    fi' HEAD

# 如果执行时提示A previous backup already exists in refs/original/,说明已经执行过一次,使用以下命令解决
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch Rakefile' HEAD

# 如果已提交到远程,别忘了强制推送
git push -f

md文档相关

文本后面加2个空格,可实现换行

vmvare虚拟机

虚拟机重启后,主机中的共享文件夹无效,执行以下命令
vmhgfs-fuse .host:/ /mnt -o allow_other -o uid=0 -o gid=0 -o umask=022