博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
git 代理 git_Git备忘单
阅读量:2504 次
发布时间:2019-05-11

本文共 2230 字,大约阅读时间需要 7 分钟。

git 代理 git

压缩一系列提交并通过将它们写为一个来重写历史记录 (Squash a series of commits and rewrite the history by writing them as one)

git rebase -i

git rebase -i

this puts you in the interactive rebasing tool.

这将使您进入交互式基础调整工具。

Type s to apply squash to a commit with the previous one. Repeat the s command for as many commits as you need.

键入ssquash应用于上一次提交。 根据需要重复执行s命令以进行尽可能多的提交。

进行位于单独分支中的提交,并在当前分支上应用相同的更改 (Take a commit that lives in a separate branch and apply the same changes on the current branch)

single commit:

单次提交:

git cherry-pick <commit>

git cherry-pick <commit>

for multiple commits:

对于多个提交:

git cherry-pick <commit1> <commit2> <commit3>

git cherry-pick <commit1> <commit2> <commit3>

将文件的状态恢复到上一次提交(还原更改) (Restore the status of a file to the last commit (revert changes))

git checkout -- <filename>

git checkout -- <filename>

显示提交历史的漂亮图表 (Show a pretty graph of the commit history)

git log --pretty=format:"%h %s" --graph

git log --pretty=format:"%h %s" --graph

获取更漂亮的日志 (Get a prettier log)

git log --pretty=format:"%h - %an, %ar : %s"

git log --pretty=format:"%h - %an, %ar : %s"

获得较短的状态 (Get a shorter status)

git status -s

git status -s

在本地结帐拉取请求 (Checkout a pull request locally)

git fetch origin pull/<id>/head:<branch>

git fetch origin pull/<id>/head:<branch>

git checkout <branch>

git checkout <branch>

列出涉及特定文件的提交 (List the commits that involve a specific file)

git log --follow -- <filename>

git log --follow -- <filename>

列出涉及特定文件的提交,包括提交内容 (List the commits that involve a specific file, including the commits content)

git log --follow -p -- <filename>

git log --follow -p -- <filename>

列出按提交数量排序的存储库贡献者 (List the repository contributors ordering by the number of commits)

git shortlog -s -n

git shortlog -s -n

撤消您推送到远程的最后一次提交 (Undo the last commit you pushed to the remote)

git revert -n HEAD

git revert -n HEAD

选择您尚未提交的所有更改并创建一个新分支 (Pick every change you haven’t already committed and create a new branch)

git checkout -b <branch>

git checkout -b <branch>

停止跟踪文件,但将其保留在文件系统中 (Stop tracking a file, but keep it in the file system)

git rm -r --cached

git rm -r --cached

获取进行特定提交的分支的名称 (Get the name of the branch where a specific commit was made)

git branch --contains <commit>

git branch --contains <commit>

翻译自:

git 代理 git

转载地址:http://elqgb.baihongyu.com/

你可能感兴趣的文章
CI框架源码学习笔记2——Common.php
查看>>
005---书籍添加和编辑的提交数据
查看>>
使用case语句给字体改变颜色
查看>>
JAVA基础-多线程
查看>>
面试题5:字符串替换空格
查看>>
JSP九大内置对象及四个作用域
查看>>
OCAC公告
查看>>
Modernizr.js介绍与使用
查看>>
ConnectionString 属性尚未初始化
查看>>
解决Spring MVC无法接收AJAX使用PUT与DELETE请求传输的内容
查看>>
数据结构-栈 C和C++的实现
查看>>
发布功能完成
查看>>
C#获取客服端ip和用户名
查看>>
Asp.net MVC 之ActionResult
查看>>
jQuery Easy UI (适应屏幕分辨率大小)布局(Layout)
查看>>
ES6学习之字符串的扩展
查看>>
[SDOI2014]旅行
查看>>
scala学习笔记-Actor(19)
查看>>
ADT+NDK+OpenCV 环境部署
查看>>
GDB调试实用命令
查看>>