本文共 1433 字,大约阅读时间需要 4 分钟。
git init 创建本地般版本库
git add . 添加所有当前目录的文件到版本库
git commit -m "xxxxx" 提交代码
git push 提交到github(前提:已经设置好了提交的github仓库地址)
git checkout . 回复当前目录的文件
git remove 删除文件
git pull 从github中更新本地代码(这个删除掉的文件没办法重新更新回来)
git clone "http:www.github.com/xubaipei.smartchat" (这个对于我们来说用的非常多的一个命令)
git status 查看当前版本库的状态,是否有更改
git deff 查看修改的内容
git log -pretty=xxx 查询xxx的日志
git reset --hard 322333 回到指定的版本 参数head^回到上一个版本
git relog 命令记录日志
git 统计代码行数
git log --author="username" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -
git cherry-pick commitid 将该提交代码加入到当前分支
git checkout -b xxx(本地分支) origin/xxx(远程分支) 检出以远程分支创建本地分支
git merge xxx(和 并xxx 分支到当前分支)
git statsh save 保存当前修改,回到修改前
git stash pop 获得保存代码
部分检出
mkdir devops && cd devops
git init git remote add -f origin https://github.com/seabluescn/ML_BinaryClassification.git git config core.sparsecheckout true echo PassPort* >> .git/info/sparse-checkout git pull origin mastergit check out
设置ssh
ssh-keygen -t -rsa -C "847923861@qq.com"
不输入密码 ,连按三次,将生成的id_rsa.pub 中的内容在github 账号上添加
2应用patch:
先检查patch文件:git apply --stat newpatch.patch 检查能否应用成功:git apply --check newpatch.patch 打补丁:git am --signoff < newpatch.patchgit format-patch commit-id
git am --abort
git am patch patch/*.patch
3.生成修改补丁文件
git diff --name-only auto-t507-q-v1.1rc5 product-auto-t507-q-stable | xargs tar -jcvf file.tar.bz2
转载地址:http://qhoin.baihongyu.com/