A Visual Git Reference

Unity Visual Scripting实战:从节点图到高效游戏开发工作流 可视化编程通过节点与连线的图形化界面,将复杂的代码逻辑转化为直观的流程图,其核心原理是降低编程门槛并提升逻辑的可视化程度。这一技术为游戏开发带来了显著价值,特别是在快速原型验证、跨职能协作以及逻辑清晰表达方面。在Unity引擎中,Visual Scripting系统作为内置的可视化脚本工具,广泛应用于游戏玩法逻辑构建、UI交互设计以及AI状态机实现等场景。通过掌握其核心的图、节点、变量与事件四要素,开发者能够将C#代码与可视化脚本高效融合,从而优化开发流程,提升团队协作效率。本文聚焦于Unity Visua 阅读详情

A Visual Git Reference

This page gives brief, visual reference for the most common commands in git. Once you know a bit about how git works, this site may solidify your understanding. If you're interested in how this site was created, see my GitHub repository.

Contents

  1. Basic Usage
  2. Conventions
  3. Commands in Detail
    1. Diff
    2. Commit
    3. Checkout
    4. Committing with a Detached HEAD
    5. Reset
    6. Merge
    7. Cherry Pick
    8. Rebase
  4. Technical Notes

Basic Usage

The four commands above copy files between the working directory, the stage (also called the index), and the history (in the form of commits).

  • git add files copies files (at their current state) to the stage.
  • git commit saves a snapshot of the stage as a commit.
  • git reset -- files unstages files; that is, it copies files from the latest commit to the stage. Use this command to "undo" a git add files. You can also git reset to unstage everything.
  • git checkout -- files copies files from the stage to the working directory. Use this to throw away local changes.

You can use git reset -p, git checkout -p, or git add -p instead of (or in addition to) specifying particular files to interactively choose which hunks copy.

It is also possible to jump over the stage and check out files directly from the history or commit files without staging first.

  • git commit -a is equivalent to running git add on all filenames that existed in the latest commit, and then running git commit.
  • git commit files creates a new commit containing the contents of the latest commit, plus a snapshot of files taken from the working directory. Additionally, files are copied to the stage.
  • git checkout HEAD -- files copies files from the latest commit to both the stage and the working directory.

Conventions

In the rest of this document, we will use graphs of the following form.

Commits are shown in green as 5-character IDs, and they point to their parents. Branches are shown in orange, and they point to particular commits. The current branch is identified by the special reference HEAD, which is "attached" to that branch. In this image, the five latest commits are shown, with ed489 being the most recent. master (the current branch) points to this commit, while maint (another branch) points to an ancestor of master's commit.

Commands in Detail

Diff

There are various ways to look at differences between commits. Below are some common examples. Any of these commands can optionally take extra filename arguments that limit the differences to the named files.

Commit

When you commit, git creates a new commit object using the files from the stage and sets the parent to the current commit. It then points the current branch to this new commit. In the image below, the current branch is master. Before the command was run, master pointed toed489. Afterward, a new commit, f0cec, was created, with parent ed489, and then master was moved to the new commit.

This same process happens even when the current branch is an ancestor of another. Below, a commit occurs on branch maint, which was an ancestor of master, resulting in 1800b. Afterward, maint is no longer an ancestor of master. To join the two histories, a merge (or rebase) will be necessary.

Sometimes a mistake is made in a commit, but this is easy to correct with git commit --amend. When you use this command, git creates a new commit with the same parent as the current commit. (The old commit will be discarded if nothing else references it.)

A fourth case is committing with a detached HEAD, as explained later.

Checkout

The checkout command is used to copy files from the history (or stage) to the working directory, and to optionally switch branches.

When a filename (and/or -p) is given, git copies those files from the given commit to the stage and the working directory. For example, git checkout HEAD~ foo.c copies the file foo.c from the commit called HEAD~ (the parent of the current commit) to the working directory, and also stages it. (If no commit name is given, files are copied from the stage.) Note that the current branch is not changed.

When a filename is not given but the reference is a (local) branch, HEAD is moved to that branch (that is, we "switch to" that branch), and then the stage and working directory are set to match the contents of that commit. Any file that exists in the new commit (a47c3 below) is copied; any file that exists in the old commit (ed489) but not in the new one is deleted; and any file that exists in neither is ignored.

When a filename is not given and the reference is not a (local) branch — say, it is a tag, a remote branch, a SHA-1 ID, or something likemaster~3 — we get an anonymous branch, called a detached HEAD. This is useful for jumping around the history. Say you want to compile version 1.6.6.1 of git. You can git checkout v1.6.6.1 (which is a tag, not a branch), compile, install, and then switch back to another branch, say git checkout master. However, committing works slightly differently with a detached HEAD; this is covered below.

Committing with a Detached HEAD

When HEAD is detached, commits work like normal, except no named branch gets updated. (You can think of this as an anonymous branch.)

Once you check out something else, say master, the commit is (presumably) no longer referenced by anything else, and gets lost. Note that after the command, there is nothing referencing 2eecb.

If, on the other hand, you want to save this state, you can create a new named branch using git checkout -b name.

Reset

The reset command moves the current branch to another position, and optionally updates the stage and the working directory. It also is used to copy files from the history to the stage without touching the working directory.

If a commit is given with no filenames, the current branch is moved to that commit, and then the stage is updated to match this commit. If --hard is given, the working directory is also updated. If --soft is given, neither is updated.

If a commit is not given, it defaults to HEAD. In this case, the branch is not moved, but the stage (and optionally the working directory, if --hard is given) are reset to the contents of the last commit.

If a filename (and/or -p) is given, then the command works similarly to checkout with a filename, except only the stage (and not the working directory) is updated. (You may also specify the commit from which to take files, rather than HEAD.)

Merge

A merge creates a new commit that incorporates changes from other commits. Before merging, the stage must match the current commit. The trivial case is if the other commit is an ancestor of the current commit, in which case nothing is done. The next most simple is if the current commit is an ancestor of the other commit. This results in a fast-forward merge. The reference is simply moved, and then the new commit is checked out.

Otherwise, a "real" merge must occur. You can choose other strategies, but the default is to perform a "recursive" merge, which basically takes the current commit (ed489 below), the other commit (33104), and their common ancestor (b325c), and performs a three-way merge. The result is saved to the working directory and the stage, and then a commit occurs, with an extra parent (33104) for the new commit.

Cherry Pick

The cherry-pick command "copies" a commit, creating a new commit on the current branch with the same message and patch as another commit.

Rebase

A rebase is an alternative to a merge for combining multiple branches. Whereas a merge creates a single commit with two parents, leaving a non-linear history, a rebase replays the commits from the current branch onto another, leaving a linear history. In essence, this is an automated way of performing several cherry-picks in a row.

The above command takes all the commits that exist in topic but not in master (namely 169a6 and 2c33a), replays them onto master, and then moves the branch head to the new tip. Note that the old commits will be garbage collected if they are no longer referenced.

To limit how far back to go, use the --onto option. The following command replays onto master the most recent commits on the current branch since 169a6 (exclusive), namely 2c33a.

There is also git rebase --interactive, which allows one to do more complicated things than simply replaying commits, namely dropping, reordering, modifying, and squashing commits. There is no obvious picture to draw for this; see git-rebase(1) for more details.

Technical Notes

The contents of files are not actually stored in the index (.git/index) or in commit objects. Rather, each file is stored in the object database (.git/objects) as a blob, identified by its SHA-1 hash. The index file lists the filenames along with the identifier of the associated blob, as well as some other data. For commits, there is an additional data type, a tree, also identified by its hash. Trees correspond to directories in the working directory, and contain a list of trees and blobs corresponding to each filename within that directory. Each commit stores the identifier of its top-level tree, which in turn contains all of the blobs and other trees associated with that commit.

If you make a commit using a detached HEAD, the last commit really is referenced by something: the reflog for HEAD. However, this will expire after a while, so the commit will eventually be garbage collected, similar to commits discarded with git commit --amend or git rebase.


Copyright © 2010, Mark Lodato. Japanese translation © 2010, Kazu Yamamoto. Korean translation © 2011, Sean Lee. Russian translation © 2012, Alex Sychev. French translation © 2012, Michel Lefranc. Chinese translation © 2012, wych. Spanish translation © 2012, Lucas Videla. Italian translation © 2012, Daniel Londero. German translation © 2013, Martin Funk. Slovak translation © 2013, Ľudovít Lučenič.

 This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.

Want to translate into another language?

visualizing-git:可视化常见的Git操作如何影响提交图 可视化Git Git是一个非常强大的工具-它可能会令人困惑。 通过D3提供的可视化功能使Git命令变得神秘。 在尝试一下! 说明了当您使用常见的Git操作时引擎盖下发生的事情。 您将看到提交图到底发生了什么。 我们旨在支持所有最基本的git操作,包括与遥控器进行交互。 以下是一些您可以用它做的有趣事的示例: 变基 樱桃采摘 推拉 支持的运营 在命令框中键入help以查看支持的操作的列表 pres() =打开演示者模式undo =撤消最后一个git命令redo =重做最后一个撤消的git命令mode =更改模式( local或remote ) clear =清除历史记录窗格并重置可视化 可用的Git命令: git branch git checkout git cherry_pick git commit git fetch git log git merge git pull g 立即下载

相关推荐

STK中的传感器与通信组件:雷达、发射机、接收机与天线的协同建模

本文深入解析了STK软件中传感器、雷达、发射机、接收机与天线的协同建模方法。通过构建一个完整的卫星对地数传系统实例,阐述了各组件如何分工协作,实现从几何指向到射频链路的高保真仿真,为复杂航天通信与探测系统的设计与分析提供了高效、灵活的解决方案。

weixin_29271263的博客 274

Git学习笔记

Git

Lee_01的博客 763

如何实现VMware虚拟机上的ubuntu与windows主机共享文件夹

windows主机部分   在硬盘上任意位置新建文件夹,此处命名为Share,实际上随意。 接下来右键属性,操作如下系列图所示: 在硬盘上任意位置新建文件夹,此处命名为Share,实际上随意。 成功修改后,显示如下界面: VMware部分 ubuntu在关机状态下,点击“编辑虚拟机设置” 接下来,开启ubuntu系统,在终端输入: ·· vmware-hgfsclient ·· 将会显示如下画面,但是此时你可能找不到 /mnt/hgfs 这个路径,如果找不到该路径,则需要在虚拟

Mr.Sliver的博客 8221

GIT 初学者教程

教程链接 Interactive Git Tutorials Learn Git Version Control using Interactive Browser-Based Scenarios Interactive Git Tutorials Resources to learn Git Learn Git Branching A Visual Git Reference 图解 Git Git 教程

icbm的专栏 662

Zynq 【SDK裸机开发之PS】——DDR的内存分配使用详解

Zynq如果跑操作系统的话,内存管理的工作都会交给系统来操作,但是如果是裸机的话,则需要自己对DDR3的内存进行管理。

shizhibuyi1234的博客 7381

【嵌入式Linux】EC20模块多运营商自适应PPP拨号实战:从IMSI识别到网络配置

本文详细介绍了在嵌入式Linux系统中,如何基于EC20 4G模块实现多运营商自适应PPP拨号。通过解析SIM卡的IMSI识别运营商,并动态配置对应的APN和拨号参数,结合AT指令交互与健壮的pppd脚本,解决了设备跨地域部署时的网络自动连接问题,提升了物联网设备的部署效率和稳定性。

fox11的博客 906

PyTorch-NPU/stable-diffusion-2-1模型架构解析:从文本到图像的完整流程

PyTorch-NPU/stable-diffusion-2-1是基于PyTorch框架的文本到图像生成模型,它能够将文字描述转换为高质量图像。本文将深入解析该模型的架构组成和工作流程,帮助新手理解AI绘图的核心原理。 ## 📌 模型核心组件 stable-diffusion-2-1模型由多个关键模块协同工作,共同完成从文本到图像的转换过程: ### 1. 文本编码器(Text Encod

gitblog_01115的博客 498

差分运放电路输出电压偏置设计解析

差分运算放大电路是信号处理中的基础模块,通过差分对管结构实现共模抑制与差模放大。其核心原理基于运放的虚短虚断特性,当电阻网络满足对称条件时,输出电压与输入差分成正比。在工业测量系统中,由于ADC通常仅支持正电压输入,需要通过偏置电路将双极性信号平移至正电压范围。典型设计采用精密基准电压源和匹配电阻网络,既保持信号完整性又满足系统接口要求。本文以-100V高压测量为例,详细解析了分压网络设计、参考电压选取以及电阻匹配等关键技术要点,为传感器接口电路设计提供实践参考。

weixin_35750747的博客 471

A visval git reference实践记录

A visval git reference的简易性让许多人入门了git,但是对于其中的命令,因为缺少实践,而理解的不清楚。作者根据自己学习AVGR的经历,写一下对于其中一些命令操作的思考。图全部来源于A visval git reference~

CRX的博客 320

OpenClaw实操:给网站装上“智能眼睛”?手把手教你用OpenClaw实时监控网站

本文介绍如何在Windows系统使用OpenClaw构建智能网站监控助手。手把手教你通过配置本地AI模型,让openclaw构建的ai助手自动检测指定网页的内容变化,理解更新重要性,并及时通过邮件、微信、Telegram等渠道发出预警,让你第一时间掌握关键信息,彻底告别手动刷新。

plawuyue的博客 2165

WebRTC Qos优化杂记

本文是笔者对WebRTC Qos性能研究、优化的一些思考,希望对有兴趣的读者有一些启发。

sonysuqin的专栏 6679

visual-git-guide备忘

内容来自:http://marklodato.github.com/visual-git-guide/index-en.html   什么是reference: reference,引用指的都是.git下的文件。HEAD就是reference中的一个, HEAD的指向的都是current branch。注意branch上面箭头表示可以移动到任意一个commit的id上。commit的箭头表示指...

weixin_33850890的博客 125

K230目标识别数字提问:模型只能识别近距离的目标,稍远一点就无法正确检测...如何解决?

🏆 本文收录于《全栈Bug调优(实战版)》专栏,致力于分享我在项目实战过程中遇到的各类Bug及其原因,并提供切实有效的解决方案。无论你是初学者还是经验丰富的开发者,本文将为你指引出一条更高效的Bug修复之路,助你早日登顶,迈向财富自由的梦想🚀!同时,欢迎大家关注、收藏、订阅本专栏,更多精彩内容正在持续更新中。让我们一起进步,Up!Up!Up!    备注: 部分问题/难题源自互联网,经过精心筛选和整理,结合数位十多年大厂实战经验资深大佬经验总结所得,数条可行方案供所需之人参考。

**My Coding Family** 1903

CMake 配置构建速查与实践:Quick Reference 仓库中 CMake 备忘清单全解

这篇文章基于 Quick Reference 技术速查清单仓库中的 [CMake 备忘清单](https://link.gitcode.com/i/98edcd3107a68d74a034d6c0c97363de),系统梳理 CMake 项目从配置、构建、测试到安装、目标管理与 Presets 的完整用法。读完之后,你可以独立写出规范的顶层 `CMakeLists.txt`,掌握单配置/多配置生成

gitblog_00851的博客 1078

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

图解git中的最常用命令

本文原版英文材料见:A Visual Git Reference      此页图解git中的最常用命令。如果你稍微理解git的工作原理,这篇文章能够让你理解的更透彻。 如果你想知道这个站点怎样产生,请前往GitHub repository。 基本用法 上面的四条命令在工作目录、暂存目录(也叫做索引)和仓库之间复制文件。 git add files 把当前文件放入暂

Atlas2013的专栏 1333

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

Your project does not reference “.NETFramework,Version=v4.8“ framework. Add a reference to “报错

Your project does not reference ".NETFramework,Version=v4.8" framework. Add a reference to ".NETFramework,Version=v4.8" in the "TargetFrameworks" property of your project file and then re-run NuGet restore报错

weixin_43942765的博客 4604

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

Bagisto 实战:Laravel 开源 B2B 电商与多商户平台上手指南

Bagisto 是基于 Laravel 和 Vue.js 的开源电商平台,一套代码覆盖单店、多商户 Marketplace 和 B2B 企业采购三种形态,官方定位支持 10M+ SKU 量级的商品目录。如果你要做一个数据私有、源码可改的 B2B 电商系统,它可以作为起点。🛒 ## 从三个典型业务场景切入 ### 搭起 B2B 采购与报价流程 Omnibus 模块提供了一组 B2B 价格提供者

gitblog_00409的博客 183

MinecraftForge 模组更新完整指南:版本升级避坑与三级验收清单

Minecraft 每次大版本刷新,都会让一份 MinecraftForge 模组列表重新面临选择:留谁、升谁、弃谁。这份指南按"判断是否该升 → 搭好备份安全网 → 执行迁移 → 验收测试 → 建立长期机制"的顺序,带你走完一轮完整的 Forge 版本升级与模组更新流程,每一步都给出可直接照做的核对项。 [![MinecraftForge 模组更新升级时需要逐项审视的版本兼容细节示意](htt

gitblog_00596的博客 882

git看这篇包会

本文介绍了Git的基本配置和使用方法。主要内容包括:1) 配置用户名和邮箱;2) 生成SSH密钥并添加到GitCode;3) 管理Windows凭据;4) 创建项目的两种方式;5) 分支的创建、切换和删除;6) 分支合并操作;7) 版本回退的三种方式;8) 推荐Visual Studio Code的Git插件Git Graph和GitLens。文章提供了详细的命令行操作和截图说明,适合初学者快速掌握Git的基本操作流程。

weixin_43148062的博客 615

告别链接错误:在Qt Creator和Visual Studio中集成CSerialPort第三方库的完整配置指南

本文详细介绍了在Qt Creator和Visual Studio中高效集成CSerialPort第三方库的完整配置指南,解决常见的链接错误问题。通过实战验证的配置模板和跨平台兼容性处理,帮助开发者在工业控制、物联网等领域快速部署串口通信功能,提升开发效率。

cumi6497的博客 722

Visual Pinball安装配置完全指南:从零开始搭建你的弹球模拟环境

想要体验最真实的虚拟弹球游戏吗?Visual Pinball(VPX)是一个开源弹球桌编辑器和模拟器,让你能够创建、编辑和玩转各种弹球游戏!这个强大的工具支持Windows、Linux、macOS、iOS、Android等多个平台,提供DirectX、OpenGL和BGFX三种渲染引擎选择。无论你是弹球爱好者还是游戏开发者,这份完整指南将带你从零开始搭建Visual Pinball环境。 ##

gitblog_01002的博客 986

OpenCV 在 Windows 平台的安装与构建指南:预编译包、git-bash 脚本与源码编译实战

本文围绕 OpenCV 官方入门教程 [doc/tutorials/introduction/windows_install/windows_install.markdown](https://link.gitcode.com/i/fb3f63793fa3f896a24641a98e659462) 展开,系统梳理在 Windows 上落地 OpenCV 的三条主流路线:直接使用预编译二进制包、借助

gitblog_00276的博客 364
上一篇: 二叉树的层次遍历(广度优先遍历)
下一篇: 9-patch for Android UI
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值