美术馆网站建设总体要求,承德信息发布微信平台,1.简述网站建设流程,网站推广套餐源 | Linux公社Git 版本对比相关操作[1] 输出工作区和暂存区的不同。git diff[2] 展示暂存区和最近版本的不同git diff --cached[3] 展示暂存区、工作区和最近版本的不同git diff HEAD[4] 展示本地仓库中任意两个 commit 之间的文件变动git diff commit-id commit-… 源 | Linux公社Git 版本对比相关操作[1] 输出工作区和暂存区的不同。git diff
[2] 展示暂存区和最近版本的不同git diff --cached
[3] 展示暂存区、工作区和最近版本的不同git diff HEAD
[4] 展示本地仓库中任意两个 commit 之间的文件变动git diff commit-id commit-id
Git 分支管理相关操作[1] 展示本地分支关联远程仓库git branch -vv
[2] 列出所有远程分支git branch -r
[3] 列出本地和远程分支git branch -a
[4] 查看远程分支和本地分支的对应关系git remote show origin
[5] 删除本地分支# 创建并切换到本地分支git checkout -b branch-name# 删除本地分支git branch -d local-branchname# 重命名本地分支git branch -m new-branch-name# 快速切换到上一个分支git checkout -# 跨分支提交git checkout branch-name git cherry-pick commit-id
[6] 删除远程分支git push origin --delete remote-branchname
[7] 远程删除了分支本地也想删除git remote prune origin
[8] 关联远程分支# 关联之后 git branch -vv 就可以展示关联的远程分支名了# 同时推送到远程仓库直接 git push 命令且不需要指定远程仓库了git branch -u origin/mybranch
Git 文件处理相关操作[1] 展示所有 tracked 的文件bashgit ls-files -t
[2] 展示所有 untracked 的文件bashgit ls-files --others
[3] 展示所有忽略的文件bashgit status --ignoredgit ls-files --others -i --exclude-standard
[4] 强制删除 untracked 的文件bash# 使用clean命令后删除的文件无法找回# 不会影响tracked的文件的改动只会删除untracked的文件# 如果不指定文件文件名则清空所有工作的untracked文件git clean file-name -f
[5] 强制删除 untracked 的目录bash# 如果不指定目录名称则清空所有工作的untracked目录git clean directory-name -df
[6] 清除 gitignore 文件中记录的文件bashgit clean -X -f
[7] 恢复删除的文件bash# 得到deleting_commit信息git rev-list -n 1 HEAD -- file_path# 回到删除文件deleting_commit之前的状态git checkout deleting_commit^ -- file_path
Git 远程仓库相关操作[1] 列出所有远程仓库bashgit remote
[2] 修改远程仓库的 url 地址bashgit remote set-url origin URL
[3] 增加远程仓库地址bashgit remote add origin remote-url
Git 存储状态相关操作[1] 存储当前的修改但不用提交 commitbashgit stash
[2] 保存当前状态包括 untracked 的文件bashgit stash -u
[3] 展示所有 stashes 信息bashgit stash list
[4] 回到某个 stash 状态bashgit stash apply stash{n}
[5] 回到最后一个 stash 的状态并删除这个 stash 信息bashgit stash pop
[6] 删除所有的 stash 信息bashgit stash clear
[7] 从 stash 中拿出某个文件的修改bashgit checkout stash{n} -- file-path
Git 配置代码相关操作[1] 配置 ssh 代理bash# 直接使用shadowsocks提供的socks5代理端口$ cat ~/.ssh/configHost gitlab.comProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %pHost github.comProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
[2] 配置 http 和 socks 代理bash# 适用于 privoxy 将 socks 协议转为 http 协议的 http 端口git config --global socks.proxy 127.0.0.1:1080git config --global http.proxy http://127.0.0.1:8001git config --global https.proxy http://127.0.0.1:8001
Git 其他高级相关操作[1] 把某一个分支到导出成一个文件bashgit bundle create file branch-name
[2] 把某一个文件导入成一个分支bash# 新建一个分支分支内容就是上面 git bundle create 命令导出的内容git clone repo.bundle repo-dir -b branch-name
[3] 修改上一个 commit 的描述bash# 如果暂存区有改动同时也会将暂存区的改动提交到上一个commit中去git commit --amend
[4] 查看某段代码是谁写的bashgit blame file-name
[5] 回到某个 commit 状态并删除后面的 commit 提交bash# 和revert命令不同reset 命令会抹去某个commit_id之后的所有commit提交# 默认就是-mixed参数git reset commit-id# 回退至上个版本将重置HEAD到另外一个commit# 并且重置暂存区以便和HEAD相匹配但是也到此为止工作区不会被更改git reset -- mixed HEAD^# 回退至三个版本之前只回退了commit的信息暂存区和工作区与回退之前保持一致# 如果还要提交直接commit即可git reset -- soft HEAD~3# 彻底回退到指定commit-id的状态暂存区和工作区也会变为指定commit-id版本的内容git reset -- hard commit-id
[6] 回到远程仓库的状态bash# 抛弃本地所有的修改回到远程仓库的状态git fetch --all git reset --hard origin/master
[7] 重设第一个 commit 信息bash# 也就是把所有的改动都重新放回工作区并清空所有的commit信息这样就可以重新提交第一个commit了git update-ref -d HEAD
[8] 查找已经删除的文件提交bash# 模糊查找git log --all --full-history -- **/thefile.*# 精确查找git log --all --full-history -- path-to-filegit log --diff-filterD --summary | grep file_name | awk {print $4; exit} | xargs git log --all --# 查看所有删除文件git log --diff-filterD --summary | grep delete# 查看产出文件是谁提交的git log --diff-filterD --summary | grep -C 10 file_name
Git 给 Github 配置 RSS/* Repo releases */https://github.com/:owner/:repo/releases.atom/* Repo commits */https://github.com/:owner/:repo/commits.atom/* Private feed (You can find Subscribe to your news feed in dashboard page after login) */https://github.com/:user.private.atom?token:secret/* Repo tags */https://github.com/:user/:repo/tags.atom/* User activity */https://github.com/:user.atom
寻求报道、约稿、文案投放添加微信xixiaoyao-1备注“商务合作”后台回复关键词【入群】加入卖萌屋NLP/IR/Rec与求职讨论群后台回复关键词【顶会】获取ACL、CIKM等各大顶会论文集